retroforth/interface/rng.retro

16 lines
366 B
Forth
Raw Normal View History

# 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 'n:random d:set-source
~~~