You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
potential cross platform solution for rand at CT (avoidining 'dummy seed' of windows and other cross platform issues):
make nimble install tempfile installs a binary (these go automatically in ~/.nimble/bin IIRC, on posix), say, tempfile_helper
this binary returns the seed random.randomize() (which we can improve later, independently), or a custom proc, and prints its value
call it at CT using gorgeEx (let's say we can assume it's in PATH, or maybe allow passing a string in API to specify path to bin containing it)
this would fix windows case at CT (currently not really working because of dummy seed)
this would be more robust than relying on date +'%N' , and allow making it further more random by allowing to use pid and threadid, all in a clean way using pure nim code
The text was updated successfully, but these errors were encountered:
here is an example for getting random seed at compile time
import random
procseeder() =discardprocgetSeed(p: pointer): int=cast[int](p)
proctest(): int {.compileTime.} =var
seed =getSeed(seeder)
r =initRand(seed)
for i in1..10:
echo r.rand(int.high)
discardtest()
/cc @ba0f3
potential cross platform solution for rand at CT (avoidining 'dummy seed' of windows and other cross platform issues):
nimble install tempfile
installs a binary (these go automatically in ~/.nimble/bin IIRC, on posix), say, tempfile_helperthis binary returns the seed
random.randomize()
(which we can improve later, independently), or a custom proc, and prints its valuegorgeEx
(let's say we can assume it's in PATH, or maybe allow passing a string in API to specify path to bin containing it)note
dummy seed
)date +'%N'
, and allow making it further more random by allowing to use pid and threadid, all in a clean way using pure nim codeThe text was updated successfully, but these errors were encountered: