add system random to stdlib: std/sysrand (#16459)

This commit is contained in:
flywind
2021-02-11 18:00:01 -06:00
committed by GitHub
parent 81533a0014
commit 18c24eb4d0
6 changed files with 333 additions and 0 deletions

13
tests/stdlib/tsysrand.nim Normal file
View File

@@ -0,0 +1,13 @@
discard """
targets: "c cpp js"
"""
import std/sysrand
doAssert urandom(0).len == 0
doAssert urandom(10).len == 10
doAssert urandom(20).len == 20
doAssert urandom(120).len == 120
doAssert urandom(113).len == 113
doAssert urandom(1234) != urandom(1234) # unlikely to fail in practice