! Copyright (C) 2008 Doug Coleman ! See http://factorcode.org/license.txt for BSD license. USING: alien.c-types io io.files kernel namespaces random io.encodings.binary init accessors system ; IN: random.unix TUPLE: unix-random reader ; : ( path -- random ) binary unix-random boa ; M: unix-random random-bytes* ( n tuple -- byte-array ) reader>> stream-read ; os openbsd? [ [ "/dev/srandom" secure-random-generator set-global "/dev/arandom" system-random-generator set-global ] "random.unix" add-init-hook ] [ [ "/dev/random" secure-random-generator set-global "/dev/urandom" system-random-generator set-global ] "random.unix" add-init-hook ] if