dirt_random 
A stream of random draws seeded by text, the same on every server and in the reference generator, so a mask drawn here matches the reference's pixel for pixel. The nth draw, counting from 0, is md5("[seed]:[n]") cut to its first six hex digits: a 24-bit integer, which a DM number holds exactly.
Everything built on draws spends them in the reference's order. Never take a draw with rand() or prob(), and never take a modulo with % or %% on something that may come out negative: use DIRT_MODULO.
Vars | |
| draw_count | How many draws the stream has made, which is the next draw's number. |
|---|---|
| seed | The text every draw hashes. |
Procs | |
| New | Starts a stream at its first draw. |
| choose | Returns one of options, from one draw. |
| draw | Returns the next draw, a whole number from 0 to 16777215. |
| gauss | Returns a normally distributed number, from two draws (Box-Muller). |
| randint | Returns a whole number from low to high, both included, from one draw. |
| random | Returns the next draw as a fraction from 0 up to 1, never 1. |
| randrange | Returns a whole number from 0 up to count, never count, from one draw. |
| sample | Returns count of items without repeats, as a new list: a Fisher-Yates from the front, stopped after count
draws. items is left as it was. |
| shuffle | Shuffles items in place, from the last position down (Fisher-Yates), with one draw for each position but the first. |
| uniform | Returns a number from low up to high, from one draw. |
Var Details
draw_count 
How many draws the stream has made, which is the next draw's number.
seed 
The text every draw hashes.
Proc Details
New
Starts a stream at its first draw.
Arguments:
- seed: The stream's text, spelled as the reference spells it ("aimed_chest:0"). Seeds are text: a number is written out in full, which matches the reference for whole numbers only.
choose
Returns one of options, from one draw.
Arguments:
- options: The list to pick from.
Crashes:
- Divides by zero when
optionsis empty.
draw
Returns the next draw, a whole number from 0 to 16777215.
The draw's number goes into the hash in full, as the reference writes it, never in scientific notation.
gauss
Returns a normally distributed number, from two draws (Box-Muller).
The first draw is turned round to 1 - random(), so the log never sees 0. DM's trigonometry takes degrees.
Arguments:
- mean: The centre of the distribution.
- deviation: Its standard deviation.
randint
Returns a whole number from low to high, both included, from one draw.
Arguments:
- low: The smallest result.
- high: The largest result, no less than
low.
random
Returns the next draw as a fraction from 0 up to 1, never 1.
randrange
Returns a whole number from 0 up to count, never count, from one draw.
Arguments:
- count: How many results there are, a positive whole number.
Crashes:
- Divides by zero when
countis 0.
sample
Returns count of items without repeats, as a new list: a Fisher-Yates from the front, stopped after count
draws. items is left as it was.
Arguments:
- items: The list to pick from.
- count: How many to pick, no more than
itemsholds.
Crashes:
- Divides by zero when
countis more thanitemsholds.
shuffle
Shuffles items in place, from the last position down (Fisher-Yates), with one draw for each position but the first.
Arguments:
- items: The list to shuffle.
Returns:
itemsitself, shuffled.
uniform
Returns a number from low up to high, from one draw.
Arguments:
- low: The smallest result.
- high: The bound the result stays under.