retroforth/interface/rng.retro
crc b3ba2ba20f add s:dedup, use it for user loaded extensions; begin using it in system extensions
FossilOrigin-Name: 0dbd909ec255a66290c0b0813addeebe61626aac2b43f62d9c00c6fa5a3aae61
2023-01-24 01:04:10 +00:00

14 lines
372 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)
#10 io:scan-for
dup n:negative? [ drop 'Error:_device_(0010)_not_found s:put nl ] if;
io:invoke ;
'interface/rng.retro s:dedup d:last d:source store
~~~