Ilya Zakharevich on Thu, 1 Oct 1998 13:41:14 -0400 (EDT) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: limit number of random |
Karim BELABAS writes: > random() never produced anything bigger than 2^31-1. But I agree this could > be useful. The following patch does what you want (and improves a bit the > previous version even if the bound is < 2^31). Apply it to 2.0.11, or wait > for 2.0.12 to be released. But it is not "random" any more. There is no point in setting lesser-significance chunks to non-0, since they are calculatable based on higher-significance chunks anyway. THe simplest solution is to have a separate linear-congruence generator for higher precisions, with data being GENs, and these numbers 1000000000000654397 computed at runtime. Or (better) get a free 2048-independent-(bytes? bits?) generator from the pseudo-random webpage (if it deserves the trouble). Ilya