2ff677c5d3
FossilOrigin-Name: fc95ae344b6ea961c9e65426b0b8820104c4b9f9a74a35a125635f207fff2b16
20 lines
317 B
Text
20 lines
317 B
Text
## Random Value
|
|
|
|
~~~
|
|
{{
|
|
'io var
|
|
:identify
|
|
@io n:zero? [
|
|
#10 io:scan-for dup n:negative?
|
|
[ drop 'IO_DEVICE_TYPE_0010_NOT_FOUND s:put nl ]
|
|
[ !io ] choose ] if ;
|
|
---reveal---
|
|
:io:rng identify @io io:invoke ;
|
|
}}
|
|
~~~
|
|
|
|
Return a random value from /dev/urandom
|
|
|
|
~~~
|
|
:n:random (-n) io:rng ;
|
|
~~~
|