The following warnings occurred:
Warning [2] Undefined array key 121217 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121218 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121219 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121248 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121276 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121281 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121282 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121333 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121335 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121345 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121381 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121435 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121518 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121219 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121435 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121282 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121345 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 121518 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





35s SEED



#14

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.


#15

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.


#16

Ah ok, I must have missed it, thanks a lot, Walter!

Edit: Found it, silly me :-(


Edited: 11 Aug 2007, 12:32 p.m.

#17

Guten Abend, oder auch guten Morgen ihnen Walter, what does AFAIK mean. I sorry for being dumb Hungarian and not knowing all web sayings.


#18

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!)


#19

Hmmm, I not consider 38 old. ;)


#20

"Hmmm, I not consider 38 old. ;)"

But your kids (and other teenagers) do!

#21

SEED is the function name used by Pioneer-series (e.g, HP42S and HP-32S/SII) models onward for setting the seed value for generating pseudo-random numbers. The random-number generator and seed-setting were made available in the HP-11C introduced in late 1981, implementing those functions as "RAN#" and "STO RAN#". The HP-15C 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 HP-35s manual mentioned that its random-number generator met a test stated in a 1981 book. I wondered if material in the book provided the basis for the HP-11C/15C function. While the HP-35s gives the same random numbers as the HP-42S for a given seed value, those numbers do not match the ones provided by the HP-11C and HP-15C. 12-digit versus 10-digit mantissas might account for the differences.

With all that having been stated, SEED and RAND are seldom-used functions that don't really deserve their prominence on the HP-35s 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


#22

Pseudo-random 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 pseudo-random sequence, by means of a multiplication, an addition and a fractional-part operation.

If the random-sequence 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"
RCL 0 ; recall the seed or the last number in the sequence
9821
x ; multiply by A
.211327
+ ; add B
FRAC ; take fractional part...
STO 0 ; ...keep it as the next number in the sequence...
RTN ; and return it in X to the user convenience.

So a program to simulate a dice was as simple as

LBL "DICE"
XEQ "RANDOM"
6
x ; multiply by six to obtain a number from 0 to 5.999
1
+ ; add one to offset it to the 1 to 6.999 range
INT ; finally, just keep the 1 to 6 integer value
RTN

And a MonteCarlo example which slowly converges to Pi looked like

LBL "PI MC"   ; Pi by MonteCarlo
0
STO 1 ; Initialize iterations counter
STO 2 ; Initialize hits counter
LBL "LOOP"
XEQ "RANDOM" ; Obtain two random numbers between 0 and 1
XEQ "RANDOM" ; and use them as the components of a vector,
R > P ; obtain the vector module
1
STO + 1 ; Increment the iterations counter...
x > y? ; and, if the vector module is less than one,
STO + 2 ; ...increment the hits counter too.
RCL 2
RCL 1 ; Obtain the hits to iterations ratio...
/ ; ...which should converge to Pi / 4,
4 ; as you may notice, thinking about the raindrops
x ; falling on a square tile of unit side.
VIEW X ; Show the current approximation and
GTO LOOP ; ...keep looping!!

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 pseudo-random 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 built-in pseudo-random 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 so-considered 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 die-cast 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.


#23

Quote:
For real randomness, some die-cast 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.

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


#24

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.

#25

Quote:
Pseudo-random number generators were a "hot topic" some decades ago.

It surely was. Back then I used the following routine on my HP-29C:



LBL 0
RCL 0
Exp(x)
Exp(x)
FRC
STO 0
RTN
It 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.

#26

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 - .
02 - 5
03 - 2
04 - 8
05 - 4
06 - 1
07 - 6
08 - 3
09 - f PSE
10 - 9
11 - 9
12 - 7
13 - x
14 - f FRAC
15 - GTO 09

Mike T.


Possibly Related Threads…
Thread Author Replies Views Last Post
  A brand new calculator benchmark: "middle square method seed test" Pier Aiello 25 6,761 09-13-2013, 01:58 PM
Last Post: Pier Aiello

Forum Jump: