Nodes/MF-PipoNodes/MF Dice Roller
ComfyUI Node

MF Dice Roller

Roll a D20 for your seed, and roll again on every execution

By MomentFactory·Created 11 months ago·Updated 7 months ago· 1
MF Dice Roller
    • int
    • string
    diceD6
    custom_faces6

    You've been there: you want a random seed, but you don't want to type 19 digits into the KSampler by hand. MF Dice Roller (MF_DiceRoller) is the gloriously simple answer - pick a die, hit queue, and the node rolls a fresh random integer every single execution. It's from the MF PipoNodes pack (pierreb-mf / Moment Factory), and it's one of those nodes where the mechanism is the whole product.

    How it works

    Two inputs:

    • dice - an enum: D4, D6, D8, D10, D12, D20, D100, and DCustom.
    • custom_faces - only used when DCustom is selected; any number of sides from 1 to 999,999 (default 6).

    The roll is random.randint(1, sides), so a D6 gives you 1–6 inclusive, a D100 gives 1–100. Two outputs come out:

    • int - the roll as an integer, ready to plug into a KSampler's seed port or a Line Select index.
    • string - the same number as text, for string-based nodes.

    The node also prints the roll to the console and shows it in a widget on the canvas, so you can see what you got without hunting for a print().

    The catch you need to know

    The key detail is that the node's IS_CHANGED always returns NaN, which means ComfyUI never caches it - it re-rolls on every execution. That's a feature for exploration and a trap for reproducibility. The moment you add MF Dice Roller to a workflow, saving an image does not freeze the roll; the next queue gives you a new seed and, with it, a new image from the same prompt.

    The community's core discipline - "same seed, same result; change one variable at a time" - breaks the instant you let a dice node sit in the seed path for your final renders. So the sane pattern is:

    • Use it for exploration: roll seeds, find a keeper, then read the displayed value and hard-code it (or drop the Dice Roller out of the graph).
    • Use it for variation: roll into a Line Select index to pick a random prompt from a list, then compare what each rolled.
    • For anything where a seed must stay consistent across many steps - multi-shot story work, batch comparison - reach for MF Story Driver from the same pack instead, which pins a seed per project.

    Install

    cd ComfyUI/custom_nodes/
    git clone https://github.com/pierreb-mf/ComfyUI-MF-PipoNodes
    cd ComfyUI-MF-PipoNodes
    pip install -r requirements.txt
    

    Restart after, or use ComfyUI Manager → search "MF PipoNodes". Dependencies are just aiohttp and pyyaml; nothing to download.

    Gotchas

    • Expect re-rolls on every run. If a workflow "randomly" changes output with identical settings, a Dice Roller (or any NaN IS_CHANGED node) is almost always why.
    • custom_faces does nothing unless DCustom is selected. If you set 100 faces but left it on D6, you're rolling a D6.
    • It's Python's random, not a hardware RNG - fine for seeds, don't build a lottery on it.
    CategoryMF_PipoNodes/Random

    Inputs (2)

    NameTypeDefaultDescription
    diceCOMBOD68 options: D4, D6, D8, D10, D12, D20, +2
    custom_facesoptINT61–999999

    Outputs (2)

    NameTypeDescription
    intINT
    stringSTRING