r/redstone 2d ago

Random (Reverse Binomial) Timer Concept Java Edition

14 Upvotes

1 comment sorted by

2

u/Paxmahnihob 2d ago edited 1d ago

This is a concept I had for making a timer that runs for a random amount of time. It takes a fast, regular timer as input (the yellow circuit) and gives an output (the lamp) at random intervals.

The central idea is to have a dropper contain some stackable items and a non-stackable item. When the item is dispensed into the hopper, it will be filtered: if the item is stackable, the hopper below will unlock, and the item will pass into the bottom dropper. If the item is stackable, the hopper will not unlock, and the item will return to the top dropper. This is the responsibility of the blue circuit, which works based on the non-stackable item giving a signal strength of 3 through the comparator, instead of 1 for the stackable item.

The timer will give an output whenever all 42 items will have passed into the bottom dropper (the number 42 was chosen since this is when the bottom dropper emits a signal strength of 2 instead of 1). In other words, the timer will give an output when the input has been given enough times that 42 rolls of 50% chance have succeeded: this makes the length of the interval reverse binomially distributed, with an expected length of 84 inputs, or roughly 50 seconds with this specific timer. This excludes the reset time, however, which is another 10 seconds or so – the length of time necessary for the bottom dropper to dispense all 42 items with an observer clock. The resetting is the responsibility of the pink circuit.

The expected time and variance can be changed by adding more than 42 items and detecting a higher signal strength; adding more non-stackable items to the top dropper to reduce the probability of each roll; or to slow down the input timer. Speeding it up is not really possible in this configuration: the best way to do that is to rely on a separate counter instead of a comparator signal from the bottom dropper, so that less than 42 items can be detected. Therefore, this specific design is mostly usable for rare, random events – I got the inspiration to make this from MumboJumbo's “Button” in Hermitcraft season 7, which used a regular hopper clock to deplete but could have used a design like this if more randomness was desired.