REDSTONEPEDIA › Circuits › Randomizers

Random picker: each press lights one output at random (randomizer)

1 of 4 outputs at random · 40 blocks

Each press lights one of its 4 outputs, picked at random, each a quarter of the time, and it stays on until the next press picks again.

Fair: its outputs came up 374, 387, 367 and 408 times in 1536 presses.

the chosen output stays on until the next press · lights after 8 ticks (0.4 s) · fair over 1536 presses · made of comparator, dropper, redstone wire · fits in 7×4×4

1 of 4 outputs at randomRandomizer3D view loading (or not available in this browser)

Every size 2

The best design for each size: pick one to see it.

sizeblocksnumbers
1 of 2 outputs19 blocksthe chosen output stays on until the next press · lights after 8 ticks (0.4 s) · fair over 768 presses
1 of 4 outputs (this page)40 blocksthe chosen output stays on until the next press · lights after 8 ticks (0.4 s) · fair over 1536 presses

Try it

Press IN under the view, holding it a moment like a button press: one of the outputs (A, B, C or D) lights and stays lit until the next press picks again, at random. Press play under the view to watch a demo on a loop; touch any other control to take over.

How this design does it: Two coin flips do the picking.

Build it

Download .litematic Download the design as text

The .litematic opens in Litematica (Minecraft 26.3): every block of the design in one region. The text file is the same build written as plain text, block by block.

Comes loaded with 2 iron shovels and 2 cobblestone in its containers: the download includes them; building it by hand, put them in first.

Blocks used: comparator dropper redstone wire stone

Details: how it works, measurements and properties

In depth

each press lights exactly one of its outputs, picked at random, every output as often as the others

How to try it

Press play under the view to watch the demo on a loop (the badge reads demo with the step it is on; the same sequence is drawn as a timing diagram below). Touch any control to stop it and try the circuit yourself.

To try it: press and hold the IN button of the bar (or the cell tagged IN) to power that input; a quick tap sends a short 2-tick pulse.

Inputs are tagged in lime; the output is tagged A, B, C, D: the orange glass marker next to it glows while the output is on (the output strip by the demo badge shows its last 40 game ticks, 2 seconds). Drag to look around, pinch or scroll to zoom, step one game tick at a time with the step button.

Inputs and output over time

The input follows this schedule (the 3D view's demo plays the same). Lime: an input is on; orange: the output is on (taller = a stronger signal, 1 to 15). Time runs left to right in game ticks (20 ticks = 1 s).

INABCDticks010020030040050060070080090010001100120013001400150016001700180019002000210022002300240025002600270028002900300031003200330034003500360037003800390040004100420043004400450046004700480049005000

Swipe the diagram sideways: the whole sequence lasts 5081 ticks (4 min 14.05 s).

Step by step (97 lines)
press 1: d
press 2: d
press 3: b
press 4: a
press 5: c
press 6: b
press 7: d
press 8: a
press 9: a
press 10: b
press 11: a
press 12: d
press 13: d
press 14: a
press 15: b
press 16: c
press 17: b
press 18: a
press 19: b
press 20: b
press 21: d
press 22: c
press 23: c
press 24: c
press 25: c
press 26: d
press 27: a
press 28: d
press 29: a
press 30: b
press 31: b
press 32: d
press 33: b
press 34: a
press 35: c
press 36: d
press 37: d
press 38: c
press 39: d
press 40: c
press 41: c
press 42: c
press 43: d
press 44: b
press 45: d
press 46: b
press 47: a
press 48: d
press 49: c
press 50: b
press 51: d
press 52: b
press 53: a
press 54: b
press 55: d
press 56: a
press 57: a
press 58: a
press 59: b
press 60: b
press 61: c
press 62: a
press 63: c
press 64: d
press 65: d
press 66: d
press 67: a
press 68: d
press 69: d
press 70: c
press 71: c
press 72: a
press 73: b
press 74: d
press 75: d
press 76: a
press 77: a
press 78: d
press 79: b
press 80: a
press 81: c
press 82: d
press 83: b
press 84: c
press 85: b
press 86: b
press 87: b
press 88: d
press 89: a
press 90: a
press 91: a
press 92: b
press 93: d
press 94: d
press 95: a
press 96: a
counts: 25 24 18 29

Measurements

metricvaluewhat it means
styleholdhold: the chosen output stays on until the next press; pulse: it gives one pulse
latency8 ticks (0.4 s)game ticks from a press to its output turning on, at the slowest
presses96presses in each run (24 per output, at least 48)

Notes from its designer

Press the button and one of the four outputs turns on at random, each a quarter of the time, and stays on until the next press picks again. Two coin flips do the picking.

Properties

StudyRandomizers
KindRandom picker: each press lights one output at random (randomizer)
Blocks placed40 (not counting the input levers or buttons the view adds)
Box7×4×4 (112 blocks of space)
Made of (the blocks that change state)comparator, dropper, redstone wire
Inputs / outputsIN (repeater) / A, B, C, D
Design filerand4-compact-v112-40b

The design file

on GitHub

Design file (45 lines)
# Randomizer: 1 of 4 outputs at random · 40 blocks
# https://vjeux.github.io/redstonepedia/circuits/random/rand4-compact-v112-40b.html
name: rand4-compact-v112-40b
circuit: randomizer 4
port input: -1 1 0
port output.a: -3 1 -2
port output.b: 3 1 -2
port output.c: -2 1 -1
port output.d: 2 1 -1
nbt: 0 0 0 {Items:[{Slot:0b,id:"minecraft:iron_shovel",count:1}]}
nbt: 0 2 -3 {Items:[{Slot:0b,id:"minecraft:cobblestone",count:1}]}
nbt: 0 2 -2 {Items:[{Slot:0b,id:"minecraft:iron_shovel",count:1}]}
nbt: 1 0 0 {Items:[{Slot:0b,id:"minecraft:cobblestone",count:1}]}
origin: -3 0 -3
palette:
  A minecraft:comparator[facing=south,mode=subtract,powered=false]
  B minecraft:comparator[facing=west,mode=compare,powered=false]
  C minecraft:comparator[facing=east,mode=compare,powered=false]
  D minecraft:dropper[facing=east,triggered=false]
  E minecraft:dropper[facing=south,triggered=false]
  F minecraft:dropper[facing=west,triggered=false]
  R minecraft:redstone_wire
  S minecraft:stone
  c minecraft:comparator[facing=north,mode=subtract,powered=false]
  d minecraft:dropper[facing=north,triggered=false]
layer -1:
  .
  .
  .
  SS...SS
layer 0:
  .
  SD...SS
  DS...SS
  RCSDFBR
layer 1:
  .Sd.SS
  AR...RA
  Rc.S.cR
  ...R
layer 2:
  .RCEBR
  ...d
  ...R
  .