There was an error while loading. Please reload this page.
1 parent e3ba2e2 commit 304b1ddCopy full SHA for 304b1dd
lib/pure/random.nim
@@ -513,6 +513,7 @@ proc initRand*(seed: int64): Rand =
513
514
let now = getTime()
515
var r2 = initRand(now.toUnix * 1_000_000_000 + now.nanosecond)
516
+ doAssert seed != 0 # 0 causes `rand(int)` to always return 0 for example.
517
result.a0 = ui(seed shr 16)
518
result.a1 = ui(seed and 0xffff)
519
discard next(result)
0 commit comments