Module random

Nim's standard random number generator. Based on

http://xoroshiro.di.unimi.it/
http://xoroshiro.di.unimi.it/xoroshiro128plus.c

Types

ui = uint64
  Source

Procs

proc random(max: int): int {.gcsafe, locks: 0, raises: [], tags: [].}
Returns a random number in the range 0..max-1. The sequence of random number is always the same, unless randomize is called which initializes the random number generator with a "random" number, i.e. a tickcount.   Source
proc random(max: float): float {.gcsafe, locks: 0, raises: [], tags: [].}
Returns a random number in the range 0..<max. The sequence of random number is always the same, unless randomize is called which initializes the random number generator with a "random" number, i.e. a tickcount.   Source
proc random[T](x: Slice[T]): T
For a slice a .. b returns a value in the range a .. b-1.   Source
proc random[T](a: openArray[T]): T
returns a random element from the openarray a.   Source
proc randomize(seed: int) {.gcsafe, locks: 0, raises: [], tags: [].}
Initializes the random number generator with a specific seed.   Source
proc randomize() {.gcsafe, locks: 0, raises: [], tags: [TimeEffect].}
Initializes the random number generator with a "random" number, i.e. a tickcount. Note: Does not work for NimScript.   Source