mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
7c29018d11
FossilOrigin-Name: 6e56f20570a58f1e5a7782f7a26a3cdeaa2af17b6a58f46a63ba509366306ebf
15 lines
366 B
Forth
15 lines
366 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 'n:random d:set-source
|
|
~~~
|
|
|