[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: useful additional procedure for random bytes?

This page is part of the web mail archives of SRFI 27 from before July 7th, 2015. The new archives for SRFI 27 contain all messages, not just those from before July 7th, 2015.


> perhaps a list (of specified length), with integers 0-255 as items,
> would be the most versatile value of such a procedure.

Nice proposal! Unfortunately, there is no such thing as a "byte"
in Scheme. Hence, the portable way to get bytes (e.g. to be written
to a file as in the confidence tests) is (random (expt 2 32)) and then
decomposing the number into its bytes with modulo and quotient.
This is slow and clumsy.

I will think about it.