Seeded Random
9 nodes
On this page 9
Make Seeded Random
FunctionThis node carries no documentation.
SeededRandom(seed: Integer) -> Seeded Random
SeededRandom SeededRandom(int seed = 1)
Parameters
| name | type | default | description |
|---|---|---|---|
| seed | Integer | 1 | Which stream. Any value is a valid seed, including zero and negative numbers - the output function scrambles the state thoroughly enough that neighbouring seeds give unrelated streams. |
Returns
| result | Seeded Random |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Draws
FunctionHow many numbers have been drawn since the last SeededRandom.Restart.
Draws(Seeded Random: Seeded Random) -> Large Integer
long Draws(SeededRandom Seeded Random)
Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
Returns
| result | Large Integer |
Remarks
The position in the stream, and therefore the other half of its reproducibility: two runs that agree
on the seed and on this have drawn the same numbers. Worth asserting in a scripted run, because a
game that draws a different NUMBER of times is just as unreproducible as one that draws different
values.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Seed
FunctionThe seed this stream was made with.
Seed(Seeded Random: Seeded Random) -> Integer
int Seed(SeededRandom Seeded Random)
Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
Returns
| result | Integer |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Next Around
FunctionOne of two numbers, either side of a middle, by an even coin flip.
NextAround -> Number
Seeded Random: Seeded Random
centre: Number
spread: Numberdouble NextAround(
SeededRandom Seeded Random,
double centre,
double spread)Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| centre | Number | — | |
| spread | Number | — |
Returns
| result | Number |
Remarks
The shape a spawner keeps needing: an obstacle's gap sits somewhere in a band around the centre of
the screen, and what varies is how far and which way. Saves a game writing the same two lines.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Next Between
FunctionA number between two bounds, including the lower and excluding the upper.
NextBetween -> Number
Seeded Random: Seeded Random
minimum: Number
maximum: Numberdouble NextBetween(
SeededRandom Seeded Random,
double minimum,
double maximum)Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| minimum | Number | — | |
| maximum | Number | — |
Returns
| result | Number |
Remarks
Bounds the wrong way round are swapped rather than refused: a spawn range typed backwards is
a slip, and refusing it would take a game down mid-run for something with an obvious meaning.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Next Chance
FunctionWhether a thing with this probability happened.
NextChance -> Truth
Seeded Random: Seeded Random
probability: Numberbool NextChance(
SeededRandom Seeded Random,
double probability = 0.5)Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| probability | Number | 0.5 | From zero (never) to one (always). |
Returns
| result | Truth |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Next Unit
FunctionA number from zero up to but not including one.
NextUnit(Seeded Random: Seeded Random) -> Number
double NextUnit(SeededRandom Seeded Random)
Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
Returns
| result | Number |
Remarks
Built from the top 53 bits, which is exactly what a double's mantissa holds - so every value is
representable and the distribution is even. Taking the low bits instead is the classic way to get a
generator that is subtly worse than the one it wraps.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Next Whole
FunctionA whole number from the lower bound up to but not including the upper.
NextWhole -> Integer
Seeded Random: Seeded Random
minimumInclusive: Integer
maximumExclusive: Integerint NextWhole(
SeededRandom Seeded Random,
int minimumInclusive,
int maximumExclusive)Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — | |
| minimumInclusive | Integer | — | |
| maximumExclusive | Integer | — |
Returns
| result | Integer |
Remarks
An empty or backwards range answers the lower bound, and draws nothing - there is no number
to pick, and advancing the stream for a question with no answer would make the sequence depend on how
often a game asked an impossible one.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime
Restart
FunctionGo back to the beginning of the stream.
Restart(Seeded Random: Seeded Random)
void Restart(SeededRandom Seeded Random)
Parameters
| name | type | default | description |
|---|---|---|---|
| Seeded Random | Seeded Random | — |
Remarks
What restarting a run means for the spawner: the same seed gives the same world again.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Events Routine StateMachineState
- Declared by
- Seeded Random
- Package
- Glaze Realtime