Random
Overview
The Random type provides random number generation using Mersenne Twister (thread-local). All methods are static.
Methods
| Method | Signature | Description |
|---|---|---|
Next | () -> int | Non-negative random int64 |
NextMax | (int max) -> int | Random int in [0, max) |
NextRange | (int min, int max) -> int | Random int in [min, max) |
NextFloat | () -> float | Random float in [0.0, 1.0) |
Seed | (int seed) | Set RNG seed for reproducibility |
Example
int roll = Random.NextRange(1, 7); // Dice roll 1-6float chance = Random.NextFloat(); // 0.0 to 1.0Random.Seed(42); // Reproducible sequence