From: Yukihiro Matsumoto Date: 2006-11-13T18:27:51+09:00 Subject: Re: External entropy pool for random number generator Hi, In message "Re: External entropy pool for random number generator" on Mon, 13 Nov 2006 18:09:37 +0900, "Kirill Shutemov" writes: |> It uses /dev/urandom already. |It uses only for initial random seed and when you call srand(0); I am not sure I understand. By your patch, if you specify something that responds to "read", rand() reads 4 byte integer and call srand() for each time, right? In that case, what the difference from reading from /dev/random directly, if we assume quality of randomness from /dev/random? I'm sure it is worth allowing the following srand(open("/dev/random")) loop do p rand(0x1000) end instead of open("/dev/random") do |f| loop do srand(read(4).unpack("L")) rescue nil p rand(0x1000) end end the former is shorter indeed. But it seems more difficult to read the author's intention. Is this useful in cryptography field? matz.