35s SEED  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: 35s SEED (/thread121217.html) 
35s SEED  Thomas Radtke  08112007 It appears that zero is not a valid SEED value to the random number generator. I haven't found anything in the manual about it to be a special case. Any other value seems to work.
Sorry if this has been answered already somewhere or the answer is obvious.
Re: 35s SEED  Walter B  08112007 AFAIK, zero tells the calc it may take a start value on its own. Don't remember where I read it, however. Edited: 11 Aug 2007, 12:29 p.m.
Re: 35s SEED  Thomas Radtke  08112007 Ah ok, I must have missed it, thanks a lot, Walter!
Edit: Found it, silly me :( Edited: 11 Aug 2007, 12:32 p.m.
Re: 35s SEED (& previous implementations)  Karl Schneider  08112007 SEED is the function name used by Pioneerseries (e.g, HP42S and HP32S/SII) models onward for setting the seed value for generating pseudorandom numbers. The randomnumber generator and seedsetting were made available in the HP11C introduced in late 1981, implementing those functions as "RAN#" and "STO RAN#". The HP15C added "RCL RAN#", which allowed the user to retrieve the current seed value, which was most likely the value produced by "RAN#" or stored using "STO RAN#". I noticed that the HP35s manual mentioned that its randomnumber generator met a test stated in a 1981 book. I wondered if material in the book provided the basis for the HP11C/15C function. While the HP35s gives the same random numbers as the HP42S for a given seed value, those numbers do not match the ones provided by the HP11C and HP15C. 12digit versus 10digit mantissas might account for the differences. With all that having been stated, SEED and RAND are seldomused functions that don't really deserve their prominence on the HP35s keyboard, although they are clearly grouped with the other functions for proability and statistics.  KS
Edited: 11 Aug 2007, 11:29 p.m. after one or more responses were posted
Re: 35s SEED  Long (but I hope interesting, with a little theory)  Andrés C. Rodríguez (Argentina)  08112007 Pseudorandom number generators were a "hot topic" some decades ago. The ability to use a randomized variable was a desirable feature to be used in software, from games to simulators to statistics methods (such as MonteCarlo). However, for such random features, there were some concerns: how to implement them, and how "good" they are at, well, randomness. At that time, hardware resources were scarce and expensive, and sophisticated functions may be prohibitive in terms of execution time. One of the preferred models was the congruential generator, which takes a seed (a number between 0 and 1) and generates the next number in a pseudorandom sequence, by means of a multiplication, an addition and a fractionalpart operation. If the randomsequence numbers are called s(1), s(2)...s(i), the generator works as: s(i+1) = FRAC {s(i) * A + B} In the HP25 and HP41 application programs manuals, there were programs with examples for such generators, because those calculators lack an internal random function. A classic RPN program looked like
LBL "RANDOM" So a program to simulate a dice was as simple as
LBL "DICE" And a MonteCarlo example which slowly converges to Pi looked like
LBL "PI MC" ; Pi by MonteCarlo Note that these programs intend to be clear to understand, and are not optimized for speed. The random number generation was one important part of Donald Knuth's "The Art of Computer Programming, Vol II: Seminumerical Algorithms". There, Knuth shows how a frequent mistake was to "choose a random method to create random numbers". He dramatically illustrates the point, presenting a program that does a lot of complex permutations and operations on a number ot obtain the next in a pseudorandom sequence... only to show that the program soon falls in a very short sequence which repeats itself forever. Hardly random, indeed. Then he goes a long way presenting methods to assess the "goodness" of a random number generator routine; the most powerful (and very hard to understand) was the Spectral Test, which HP claims to pass with the abovementioned routine included in the HP41 Standard Pac. Later calculator models incorporated builtin pseudorandom functions, which also depend on an initial value, called the seed. However, for the same seed, we get the same sequence; this may be good for debugging and testing purposes, but not desirable in true operation. The same happened in the BASIC computers of those years, and hence a RANDOMIZE statement appeared, which initializes the seed with a soconsidered random value, unknown to the user, and so attaining an acceptable random behaviour. In HP calculators, a value of 0 for the seed causes a similar initialization. The "randomized" seed is usually taken from some timer or counter insude the processor, which value changes very rapidly all the time, and which is not correlated to the program operation.
For real randomness, some diecast engineers resort to auxilliary circuits that sampled the thermal noise of a diode junction or similar devices. Thermal noise circuits are as close as "random" as we may meet in a whole life.
Re: 35s SEED  Long (but I hope interesting, with a little theory)  Palmer O. Hanson, Jr.  08112007 Quote: My memory tells me that Knuth introduced the subject with a statement something like this:
ANYONE WHO USES NUMERICAL METHODS TO GENERATE RANDOM NUMBERS IS IN A STATE OF SIN
Re: 35s SEED  Long (but I hope interesting, with a little theory)  Andrés C. Rodríguez (Argentina)  08112007 Knuth's introduction to the subject includes such statement, which in fact is a quote from John Von Neumann, dated 1951.
All my previous post was improvised and from memory, but for this quote I needed to look for the actual book which, fortunately, rests just a couple of meters from my PC.
WALTER: Re: 35s SEED  Vincze  08122007 Guten Abend, oder auch guten Morgen ihnen Walter, what does AFAIK mean. I sorry for being dumb Hungarian and not knowing all web sayings.
Re: WALTER: Re: 35s SEED  Ed Look  08122007 Hahaha! You do not know not because of your ethnicity; you do not know because you probably are old like most of the rest of us!! Ask a kid, preferably an adolescent or teenager they'll tell you "AFAIK" means "as far as I know". Don't worry. I learned some of this from others on the Internet, some from my children. One warning though, be prepared for the embarassing feeling that comes when your youngest one tells you with that hint of disgusted, disdainful, superiority only a child can express.
(Funny, I never dared to do that to MY father!)
and yet another rand# generator  Bram  08132007 Quote:It surely was. Back then I used the following routine on my HP29C: LBL 0It could cope with a starting value of zero and it’s about the shortest I could come up with, although it does take some time to perform. Many years later I discovered that it is not quite a uniform distribution between 0 and 1, but it would do for the applications in question.
Re: WALTER: Re: 35s SEED  Vincze  08132007 Hmmm, I not consider 38 old. ;)
Re: WALTER: Re: 35s SEED  Dave Shaffer (Arizona)  08132007 "Hmmm, I not consider 38 old. ;)"
But your kids (and other teenagers) do!
Re: 35s SEED  Long (but I hope interesting, with a little theory)  Mike T.  08142007 See below for a very similar random number generator for the HP25/25C , HP33C/E, or HP10C. (I think I originally saw this routine in the HP97 user manual  but I could be wrong as it is over 20 years since I last used an HP97.)
01  .
Mike T.
