retroforth/interface/rng.retro
crc 6335f78231 add extended sigil:( to save stack comments, d:describe
FossilOrigin-Name: dc80974119af1d3120f710c6c37be0616d2003233bffe4389ca82f9fe3d611d9
2024-09-09 12:49:56 +00:00

15 lines
371 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
~~~