- ;; XXX: This works on GNU/Linux and OS X systems, but this isn't
- ;; exactly portable.
- (open-input-file "/dev/urandom"))
+ (if (file-exists? "/dev/urandom")
+ (open-input-file "/dev/urandom")
+ ;; XXX: This works as a fall back but this isn't exactly a
+ ;; reliable source of entropy.
+ (make-soft-port (vector (const #f) (const #f) (const #f)
+ (lambda _ (let ((r (random 256))) (integer->char r)))
+ (const #f)
+ (const #t)) "r")))