Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.arch Subject: Re: IA-64 Date: Sun, 15 Mar 2026 14:14:18 -0700 Organization: A noiseless patient Spider Lines: 61 Message-ID: <86y0js6bit.fsf@linuxsc.com> References: <10n6ts2$3fjht$1@dont-email.me> <10o9s6b$34qug$1@dont-email.me> <20260304202556.000063d9@yahoo.com> <10oa6tk$38csm$1@dont-email.me> <10onere$3o39t$1@dont-email.me> <86pl5874op.fsf@linuxsc.com> <10p3uoo$bka8$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sun, 15 Mar 2026 21:14:27 +0000 (UTC) Injection-Info: dont-email.me; posting-host="37fbd2bc0a39a2e0da8dcfefffa00bf6"; logging-data="1460169"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/giXySMeO+UnATuyZB13ABZA8WJ+D7nJ0=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:qk9YmBMJz8tezDP6/KH7UOCpj8E= sha1:O/avU4ctne0ocWSLNs8Oi59mevQ= Xref: csiph.com comp.arch:115356 Terje Mathisen writes: > Tim Rentsch wrote: > >> Terje Mathisen writes: >> >>> Kent Dickey wrote: >>> >>>> There is one very reasonable use case: testing a random number >>>> generator. A useful test is to ensure numbers are uncorrelated, >>>> so you get 3 random numbers called A, B, C, and you look up A*N*N >>>> + B*N + C to count the number of times you see A followed by B >>>> followed by C, where N is the range of the random value, say, 0 - >>>> 1023. This would be an array of 1 billion 32-bit >>> >>> I would be quite happy with half the size, i.e. 1e9 u16 entries. >>> >>>> values. You get 1000 billion random numbers, and then look >>>> through to make sure most buckets have a value around 1000. Any >>>> buckets less than 500 or more than 1500 might be considered a >>>> random number generator failure. This is a useful test since it >>>> intuitively makes sense--if some patterns are too likely (or >>>> unlikely), then you know you have a problem with your "random" >>>> numbers. >>> >>> I haven't done the math, but I would guess getting any deviation >>> outside the 800-1200 range would be quite unlikely, and at least >>> suspicious! >> >> I think your intuition may be somewhat askew here. I also haven't >> done any math, but looking at some empirical results suggests the >> range of 800-1200 is near the boundary of "unsurprising values". > > That's why I added the 'at least suspicious' trailer. :-) I realized you were hedging your bets. At this point I'm not sure that having a value outside the 800-1200 range is even suspicion. Outside the range of 750-1250, definitely, but not yet the narrower range. The empirical results are suggestive but (for me) not definite enough. I think it's worth adding that looking for an exceptional value is not really a great test. A better test is to count the number of values less than 850 (and similarly greater than 1150), and to compare that against the expected value. Too high or too low means the generator is biased. An unrelated item for your reading pleasure... Take an unbiased coin and start flipping it. Keep flipping until the number of heads first exceeds the number of tails. Compute the fraction: the number of heads divided by the number of flips (which always gives a number between 0.5 and 1.0). Repeat the above process as many times as desired. Compute the average of all the fractions and what do you get? I heard about this yesterday from a friend. That's a hint, of sorts. (It is now Sunday afternoon where I am.)