UniformInt
Generate a uniform random integer in using generator . This draw is derived from the underlying uniform float stream.
- Range — (includes , excludes )
- Complexity — per draw
Example (conceptual)
- Call —
Rng(42).UniformInt(a, b)(conceptual name; see mapping below) - Range — integer in or
Implementation names
| Language | Method |
|---|---|
| C# | UniformInt32() / UniformInt64() / UniformInt16() / UniformInt8() |
| Go | UniformIntN() / UniformInt64() / UniformInt32() / UniformInt16() / UniformInt8() |
| Kotlin | uniformInt() / uniformLong() / uniformShort() / uniformByte() |
| Rust | uniform_i32() / uniform_i64() / uniform_i16() / uniform_i8() |
| Python | uniform_int() |
| R | uniform_int() |
| TypeScript | uniformInt() |
draws are derived from the same generator core as and map a uniform 64-bit value into . The implementation uses modulo reduction; ranges that do not divide introduce a slight bias (acceptable for simulation, not for cryptographic use). See UniformFloat → Algorithm for the core generator details.
Unsigned variants are available in languages that support them.