From: Kirill Shutemov Date: 2006-11-13T19:25:13+09:00 Subject: Re: External entropy pool for random number generator On 11/13/06, Yukihiro Matsumoto wrote: > 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? It allow you specify entropy pool once(in platform specific way) and use it anywhere.