Nodes/Raffle/Lottery (Raffle)
ComfyUI Node

Lottery (Raffle)

Roll random tags from your own lists, weighted however you like

By rainlizard·Created about a year ago·Updated 2 days ago· 38
Lottery (Raffle)
    • Random tags
    directory/tmp/ComfyUI/custom_nodes/ComfyUI-Raffle/lottery/
    filenamesBlowjob.txt Blowjob.txt Blowjob.txt Blowjob.txt Handjob.txt Handjob.txt VaginalBackAllFours.txt VaginalBackProne.txt VaginalBackSideLying.txt VaginalBackStanding.txt VaginalFrontOnTop.txt VaginalFrontSeated.txt VaginalFrontStanding.txt VaginalFrontStraddle.txt VaginalSideLying.txt VaginalSideSeated.txt
    remove_underscorestrue
    seed0
    count_min15
    count_max15

    Lottery (Raffle) is the hand-picked little brother of the Raffle node. Where Raffle draws from 400,000 scraped Danbooru taglists, Lottery draws from your own text files - you decide the pools, it decides the outcome. You feed it a folder of tag lists, it picks one file at random, then spits out a seeded random handful of tags from that file. That's the whole job, and for anime-tag models like Illustrious and NoobAI it's a genuinely nice way to generate variations without babysitting wildcard syntax.

    Think of it as prompt roulette: one run you get a standing pose with a school uniform, the next a seated one. If you're batch-generating variations or farming ideas, this is the part that removes the choice from your hands so the model can surprise you.

    How it works

    The mechanism is delightfully simple and entirely offline. On each execution the node:

    1. Picks a filename from your multiline list - duplicates act as weight, so Blowjob.txt listed four times is four times as likely to win as a file listed once.
    2. Loads that file from the directory you give it.
    3. Rolls a count between count_min and count_max, then samples that many lines with no repeats.
    4. Joins them with commas and hands you a single string ready for your positive prompt.

    Everything is seeded from the seed input - same seed, same filename, same count, same tags. That's the feature that makes it workflow-friendly: fix the seed when you like a result, nudge it when you want variety. No API calls, no model downloads, no dependencies beyond Python's stdlib (random, pathlib). The randomness is standard Python random, so don't expect cryptographic-grade anything - you just want reproducible variety.

    One honest thing to flag up front: the shipped defaults are adult scenario lists (the lottery/ folder ships with files like Blowjob.txt and VaginalBackAllFours.txt, weighted toward the first). The pack is squarely aimed at NSFW-capable Danbooru-trained models. Nothing forces you to use those - point directory anywhere and name your own .txt files - but if that content isn't your thing, don't skip past the default folder.

    The inputs and outputs that matter

    There are only six inputs and you'll actually touch three of them:

    • filenames - one filename per line. Duplicate lines to weight a file higher. This is where the node's personality lives.
    • directory - folder containing those files. Defaults to the pack's own lottery/ folder, so it works out of the box.
    • count_min / count_max - the inclusive range of tags to draw. Set both to the same number for a fixed count, or leave a spread for variety (default 15–15).
    • seed - the reproducibility knob. Same seed, same output.
    • remove_underscores - replaces _ with spaces in the output (default on). Keep this on for Anima, which doesn't appreciate underscores; Illustrious and NoobAI are happy either way.

    The single output, Random tags (a STRING), wires straight into a text-concat node feeding your positive prompt. There's no negative-prompt handling here - that's the main Raffle node's job. Lottery just hands you tags.

    Install

    The whole pack is pure Python with zero extra requirements - no model files, no pip packages. Either way:

    • ComfyUI Manager: search "Raffle" and install.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/rainlizard/ComfyUI-Raffle, then restart ComfyUI.

    You'll find Lottery (Raffle) under the "Raffle" category in the node menu. The tag lists ship inside the pack, so there's nothing to download separately.

    Common issues

    The errors here are loud and literal, which is a relief:

    • Lottery: directory does not exist - you pointed directory somewhere wrong, or you're running a stale copy whose lottery/ folder got deleted. Check the path.
    • Lottery: selected file does not exist - a filename in your list doesn't match a file in the folder. Usually a typo or an extension mismatch.
    • Lottery: count_min cannot be greater than count_max - flip them. That's it.
    • Non-UTF-8 file error - your tag file has an encoding other than UTF-8 (with or without BOM). Save it as UTF-8.

    Worth knowing: blank lines in your tag files are silently ignored, and a file with zero usable lines errors out rather than returning an empty string. If a file has fewer lines than count_min, the node quietly clamps down to what's available instead of crashing.

    Where people get burned: expecting the output to know about your negative prompt. It won't - that's a different node in this pack. If you want danbooru-wide randomness with filtering, use the main Raffle node; if you want exactly the pools you curate, this is the one.

    CategoryRaffle

    Inputs (6)

    NameTypeDefaultDescription
    directorySTRING/tmp/ComfyUI/custom_nodes/ComfyUI-Raffle/lottery/Directory containing the files listed below.
    filenamesSTRINGBlowjob.txt Blowjob.txt Blowjob.txt Blowjob.txt Handjob.txt Handjob.txt VaginalBackAllFours.txt VaginalBackProne.txt VaginalBackSideLying.txt VaginalBackStanding.txt VaginalFrontOnTop.txt VaginalFrontSeated.txt VaginalFrontStanding.txt VaginalFrontStraddle.txt VaginalSideLying.txt VaginalSideSeated.txtOne filename per line. Duplicate filenames increase their chance of being selected.
    remove_underscoresBOOLEANtrueReplace underscores with spaces in the output tags.
    seedINT00–18446744073709550000Seed used for the file, count, and tag selections.
    count_minINT151–1000Minimum number of tags to select.
    count_maxINT151–1000Maximum number of tags to select.

    Outputs (1)

    NameTypeDescription
    Random tagsSTRINGRandom tags from a randomly selected listed file.