File tree 1 file changed +3
-13
lines changed
1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -26,19 +26,9 @@ else # !windows
26
26
27
27
rand (rd:: RandomDevice , sp:: SamplerBoolBitInteger ) = read (getfile (rd), sp[])
28
28
29
- function getfile (rd:: RandomDevice )
30
- tid = Threads. threadid ()
31
- devrandom = rd. unlimited ? DEV_URANDOM : DEV_RANDOM
32
- @assert 0 < tid <= length (devrandom)
33
- @inbounds if isassigned (devrandom, tid)
34
- devrandom[tid]
35
- else
36
- devrandom[tid] = open (rd. unlimited ? " /dev/urandom" : " /dev/random" )
37
- end
38
- end
29
+ getfile (rd:: RandomDevice ) = @inbounds DEV_RANDOM[1 + rd. unlimited]
39
30
40
31
const DEV_RANDOM = IOStream[]
41
- const DEV_URANDOM = IOStream[]
42
32
43
33
end # os-test
44
34
310
300
311
301
function __init__ ()
312
302
resize! (empty! (THREAD_RNGs), Threads. nthreads ()) # ensures that we didn't save a bad object
303
+
313
304
if ! Sys. iswindows ()
314
- resize! (empty! (DEV_RANDOM), Threads. nthreads ())
315
- resize! (empty! (DEV_URANDOM), Threads. nthreads ())
305
+ push! (empty! (DEV_RANDOM), open (" /dev/random" ), open (" /dev/urandom" ))
316
306
end
317
307
end
318
308
You can’t perform that action at this time.
0 commit comments