retroforth/interface/rng.retro
crc 987c3a5cc1 use DEVICE: words for device ids
FossilOrigin-Name: 49f75a7d0be98b46a38b039531d7b1b71ffe05e3db942c4efaeb242310fc0898
2023-12-10 23:32:03 +00:00

15 lines
370 B
Forth

# Random Number Generator
I/O device type 10 is a random number generator. I do this as
part of the VM I/O extensions to allow implementors to use the
best approach on their host system.
~~~
:n:random (-n)
DEVICE:RNG io:scan-for
dup n:negative? [ drop 'Error:_RNG_device_not_found s:put nl ] if;
io:invoke ;
'interface/rng.retro 'n:random d:set-source
~~~