Revert sub-second randomize(). Fixes randomize for JS backend. (#10000)
Fixes #9999.
This commit is contained in:
parent
65a52ecebb
commit
513a287c61
1 changed files with 6 additions and 2 deletions
|
|
@ -224,6 +224,10 @@ when not defined(nimscript):
|
|||
proc randomize*() {.benign.} =
|
||||
## Initializes the random number generator with a "random"
|
||||
## number, i.e. a tickcount. Note: Does not work for NimScript.
|
||||
when defined(js):
|
||||
let time = int64(times.epochTime() * 1_000_000_000)
|
||||
randomize(time)
|
||||
else:
|
||||
let now = times.getTime()
|
||||
randomize(convert(Seconds, Nanoseconds, now.toUnix) + now.nanosecond)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue