std/mersenne

  Source   Edit
Deprecated: use `std/random` instead

The Mersenne Twister random number generator. .. note:: The procs in this module work at compile-time.

Example:

import std/mersenne
var rand = newMersenneTwister(uint32.high)  ## must be "var"
doAssert rand.getNum() != rand.getNum()  ## pseudorandom number

Types

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

Procs

proc getNum(m: var MersenneTwister): uint32 {....raises: [], tags: [].}
Returns the next pseudorandom uint32.   Source   Edit
proc newMersenneTwister(seed: uint32): MersenneTwister {....raises: [], tags: [].}
Creates a new MersenneTwister with seed seed.   Source   Edit