retroforth/interface/rng.retro
crc ea8e12d32a finish reorg of main sources
FossilOrigin-Name: 6a7ee82ed6b024ee1d8f7a51a9b91a66a8041cde06b53cce649d6bd383ae9677
2019-11-22 18:30:02 +00:00

16 lines
299 B
Text

## Random Number Generator
~~~
{{
'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-operation identify @io io:invoke ;
}}
:n:random (-n) io:rng-operation ;
~~~