mersenne

Example:

static:
  block:
    var rando: MersenneTwister = newMersenneTwister(uint32.high)  ## Must be "var".
    doAssert rando.getNum() != rando.getNum()  ## Pseudo random number. Works at compile-time.

Types

MersenneTwister = object
  mt: array[0 .. 623, uint32]
  index: int
Source Edit

Procs

proc newMersenneTwister(seed: uint32): MersenneTwister {...}{.raises: [], tags: [].}
Source Edit
proc getNum(m: var MersenneTwister): uint32 {...}{.raises: [], tags: [].}
Returns the next pseudo random number ranging from 0 to high(uint32) Source Edit

© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/mersenne.html