# 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. ~~~ {{ 'io var :identify @io n:zero? [ #10 io:scan-for dup n:negative? [ drop 'IO_DEVICE_TYPE_0010_NOT_FOUND s:put nl ] [ !io ] choose ] if ; ---reveal--- :io:rng-operation identify @io io:invoke ; }} :n:random (-n) io:rng-operation ; ~~~