Groups | Search | Server Info | Login | Register


Groups > comp.lang.c > #396673

Re: srand(0)

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: srand(0)
Date 2026-02-17 23:47 -0800
Organization A noiseless patient Spider
Message-ID <86y0kqfq85.fsf@linuxsc.com> (permalink)
References (7 earlier) <20251224000824.00005ce7@yahoo.com> <86tswxnznu.fsf@linuxsc.com> <20260108010601.00002085@yahoo.com> <864inyj6ug.fsf@linuxsc.com> <20260203163708.0000459e@yahoo.com>

Show all headers | View raw


Michael S <already5chosen@yahoo.com> writes:

> On Tue, 03 Feb 2026 05:26:47 -0800
> Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>
>> Michael S <already5chosen@yahoo.com> writes:
>>
>>> On Wed, 07 Jan 2026 08:41:25 -0800
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
>>>
>>>> Michael S <already5chosen@yahoo.com> writes:
>>>>
>>>>> On Tue, 23 Dec 2025 17:54:05 -0000 (UTC)
>>>>> antispam@fricas.org (Waldek Hebisch) wrote:
>>>>
>>>> [...]
>>>>
>>>>>> There is a paper "PCG:  A Family of Simple Fast Space-Efficient
>>>>>> Statistically Good Algorithms for Random Number Generation"
>>>>>> by M. O?Neill where she gives a family of algorithms and runs
>>>>>> several statistical tests against known algorithms.  Mersenne
>>>>>> Twister does not look good in tests.  If you have enough (128)
>>>>>> bits LCGs do pass tests.  A bunch of generators with 64-bit
>>>>>> state also passes tests.  So the only reason to prefer Mersenne
>>>>>> Twister is that it is implemented in available libraries.
>>>>>> Otherwise it is not so good, have large state and needs more
>>>>>> execution time than alternatives.
>>>>>
>>>>> I don't know.  Testing randomness is complicated matter.
>>>>> How can I be sure that L'Ecuyer and Simard's TestU01 suite tests
>>>>> things that I personally care about and that it does not test
>>>>> things that are of no interest for me?  Especially, the latter.
>>>>
>>>> Do you think any of the tests in the TestU01 suite are actually
>>>> counter-indicated?  As long as you don't think any TestU01 test
>>>> makes things worse, there is no reason not to use all of them.
>>>> You are always free to disregard tests you don't care about.
>>>
>>> Except that it's difficult psychologically.
>>> The batteries of test gains position of of authority in your mind.
>>> Well, may be, you specifically are resistant, but I am not.  Nor is
>>> Melissa O'Nail, it seems.
>>>
>>> To illustrate my point, I will tell you the story about myself.
>>> Sort of confession.
>>> [very large portion]
>>
>> I have read through your whole posting several times, and also
>> looked through your other postings in this thread.  Despite my
>> efforts I am still not sure what you think or what you're trying to
>> say.
>>
>> Let me put it as a question.  Do you think there is a good and
>> objective test for measuring the quality of a PRNG?  If so what test
>> (or tests) do you think would suffice?  Here "quality" is meant as
>> some sort of numeric measure, which could be a monotonic metric (as
>> in "the larger the number the higher the quality") or just a simple
>> pass/fail.
>
> I don't think that it is possible to create generic empirical tests
> of this sort.
> What is possible is a test that measures specific property that is
> known to be important for specific use.
>
>> If you don't think there is any such test, how do you propose that
>> PRNGs be evaluated?
>
> I don't know.
> But I believe in one philosophical principle that I learned first ~40
> years ago in the field unrelated to PRNGs or to Computer Science:
> when you don't know how to measure quality of your product then it is
> advisable to ask your consumer.  Do not ask a random consumer, ask the
> one who requested improvement of the property that you have
> difficulties to measure.  He is the most likely one to know.
>
> The field where I first heard about that principle was manufacturing
> of ultra-pure chemicals.

I'm surprised to see this answer from you, primarily because it
seems to confuse different aspects of the subject.

The key property of a (pseudo) random number generator is that the
values produced exhibit no discernible pattern.  Of course this
question cannot be answered absolutely, or more precisely it can be
answered definitely only in the negative.  Any affirmative answer
must be partial and also statistical rather than absolute.

If someone wants to write a PRNG for general use, there is no point
in asking users what they want, because they don't know.  Very few
people in the entire world have the mathematical sophistication
necessary to answer the question competently (I know I don't, and I
would put myself in the 75 percentile or above).  The sort of people
who could answer the question are also likely to have written test
suites like TestU01, so it seems reasonable to use one or more of
those test suites to establish a lower bar for any proposed general
pupose PRNG.

Of course there are properties besides statistical quality measures
that might be desirable, such as whether the state of the PRNG can
be readily ascertained, the size of the state space, various sorts
of cryptographic concerns, and so forth.  For some applications
there could be performance thresholds that are essential to meet,
such as how long to produce a new random value, or what the memory
footprint is.  But these concerns are outside the domain of the
question, which is only about the quality of the values produced.
Do you see now what I'm getting at?

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 08:41 -0800
  Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-08 01:06 +0200
    Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-03 05:26 -0800
      Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-02-03 16:37 +0200
        Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-17 23:47 -0800
          Re: srand(0) Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> - 2026-02-18 11:21 +0000
            Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-19 10:01 +0100
              Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-02-19 14:33 -0500
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-19 20:47 +0100
                Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-02-20 16:01 -0500
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-21 11:09 +0100
              Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-02-19 14:39 -0800
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-20 09:16 +0100
                Re: srand(0) Paul <nospam@needed.invalid> - 2026-02-23 08:32 -0500
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-23 16:05 +0100
                Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-02-23 19:59 +0200
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-23 20:06 +0100
                Re: srand(0) Paul <nospam@needed.invalid> - 2026-02-23 15:24 -0500
                Re: srand(0) Axel Reichert <mail@axel-reichert.de> - 2026-02-24 07:08 +0100
                Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-24 10:24 +0100
                Re: srand(0) Axel Reichert <mail@axel-reichert.de> - 2026-02-26 19:13 +0100

csiph-web