EmAySee Probability String Selector
Pick a string at random, but make one option rare on purpose
- PROBABILISTIC_SELECTED_STRING
EmAySee Probability String Selector picks between two strings using a weighted coin flip. You give it two strings and a probability between 0 and 1, and it returns one of them - string one with your probability, string two with the rest. It's random string selection with the odds tilted on purpose.
The use case is prompt roulette with taste. Say you've got a main prompt and you want to occasionally throw in a variation - a style switch, a character detail, a "sometimes add this element" - but you want the variation to show up, say, 15% of the time rather than 50/50. That's exactly what the probability_option_1 slider buys you: you set how often option one wins, and the node does the rest. It's the kind of small nondeterminism people use to keep a batch of generations from all looking identical, without going full wildcard roulette. The default values in the code even spell out the intent: "Option 1 - Less Likely" at 0.1 and "Option 2 - More Likely" at 0.9.
How it works
The mechanism is a single roll: the node generates a random float between 0 and 1 using Python's random.random(), and if that value is less than probability_option_1, you get string one; otherwise string two. No seeded RNG, no controllable randomness - each execution rolls fresh. That's a real behavior to know about: if you're chasing a reproducible workflow, this node is intentionally not reproducible, and there's no seed input to pin it down.
Two details that follow from the code:
probability_option_1is the chance of string one. Set it to 0.1 and option one wins about one run in ten.- Because it's a strict
<, a probability of exactly 0 means option one is impossible, and 1.0 means option two is impossible - the extremes behave as you'd expect.
The inputs that matter
Three inputs, one of them the point:
string_input_1- STRING, default "Option 1 - Less Likely".string_input_2- STRING, default "Option 2 - More Likely".probability_option_1- FLOAT from 0 to 1, step 0.01, default 0.1. The dial that sets how often string one wins.
The single output, PROBABILISTIC_SELECTED_STRING, is a STRING - wire it into a prompt builder, a text display, or anything that consumes a string.
Installing it
Part of the EmAySee pack:
# ComfyUI Manager: search "ComfyUI_EmAySee_CustomNodes" and install
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
Restart ComfyUI. No requirements.txt - it imports torch and numpy out of habit but only actually uses random.
Common issues
The big one is the reproducibility trap: no seed, no control, so don't build a workflow around "sometimes option one" and expect to recreate a specific roll later. If you need controllable randomness, look for a seeded random node instead. Also, it's two strings only - if you want weighted selection across three or more options, this pack's RandomStringSelector variants cover more choices but without per-option weights, so you may end up chaining this node or using a different pack. For the single "make one thing rare" job it's purpose-built, and for that job it's hard to beat.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| string_input_1 | STRING | Option 1 - Less Likely | — |
| string_input_2 | STRING | Option 2 - More Likely | — |
| probability_option_1 | FLOAT | 0.100–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PROBABILISTIC_SELECTED_STRING | STRING | — |