retroforth/interface/rng.retro
crc 5ba34b60a9 interfaces/rng: smaller n:random, remove io:rng-operation
FossilOrigin-Name: 893637993c41b36f620410fe489d25d5cb9d08d41dd80f9097b3c193fd54cc92
2021-04-19 17:35:29 +00:00

12 lines
320 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 ;
~~~