home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 243,226 of 243,242   
   David Brown to Tristan Wibberley   
   Re: srand(0)   
   19 Feb 26 10:01:04   
   
   XPost: sci.math.num-analysis   
   From: david.brown@hesbynett.no   
      
   On 18/02/2026 12:21, Tristan Wibberley wrote:   
   > On 18/02/2026 07:47, Tim Rentsch wrote:   
   >   
   >> The key property of a (pseudo) random number generator is that the   
   >> values produced exhibit no discernible pattern.   
   >   
   > For a PRNG, they exhibit the pattern of following the sequence of the PRNG!   
   >   
      
   As a deterministic function, a PRNG will obviously follow the pattern of   
   its generating function.  But the aim is to have no /discernible/   
   pattern.  The sequence 3, 4, 2, 1, 1, 7, 0, 6, 7 has no pattern that   
   could be identified without knowledge of where they came from - and thus   
   no way to predict the next number, 9, in the sequence.  But there is a   
   pattern there - it's the 90th - 100th digits of the decimal expansion of pi.   
      
   > Is it that, for any finite sequence of numbers from a PRNG, without   
   > information about where it came from and how many numbers came before   
   > you can't predict the next number better than chance?   
   >   
      
   That's the general aim, yes.   
      
   But Michael is absolutely correct that only the consumer can say what   
   they want to measure in order to judge the quality of any piece of code.   
     It is the customer that gives the requirement specifications, and the   
   programmer's job is to write code that fulfils those specifications.   
   PRNGs are no different.  (In practice, many customers need help figuring   
   out what their requirements are, and how to express those, but that's   
   another matter.)   
      
   In the case of PRNGs, there are many possible requirements beyond the   
   "it's hard to predict the next number in the sequence".  These include :   
      
   * Simplicity of implementation   
   * Cryptographic security of implementation   
   * Running speed   
   * Statistical distribution of values (with many possible patterns, and   
   consideration of length of samples)   
   * Repeat cycle length   
   * Psychological factors (sometimes you roll five sixes in a row, but   
   that might look like a loaded dice.  Randomised playlists often use   
   modifications to their PRNGs to avoid repetition of songs, and plotting   
   random points in a 2-D space does not look "random" to most people)   
   * Interaction with added entropy sources   
      
      
   As with most requirements for most software, turning most of these into   
   some kind of directly and objectively measurable "quality" function is   
   difficult or impossible in practice.  As Michael says, the only thing   
   you can do is when a consumer complains that it is not good enough for   
   their purposes, ask them how to identify when it would be good enough.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca