Add Documentation (#13811)

* Add more Docs and runnableExamples
This commit is contained in:
Juan Carlos 2020-03-31 10:47:57 -03:00 • committed by GitHub
commit 42d2c3088e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 135 additions and 19 deletions

View file

@ -39,6 +39,14 @@ proc getNum*(m: var MersenneTwister): uint32 =
result = result xor ((result shl 15'u32) and 0xefc60000'u32)
result = result xor (result shr 18'u32)
runnableExamples:
static:
block:
var rando: MersenneTwister = newMersenneTwister(uint32.high) ## Must be "var".
doAssert rando.getNum() != rando.getNum() ## Pseudo random number. Works at compile-time.
# Test
when not defined(testing) and isMainModule:
var mt = newMersenneTwister(2525)