beautypg.com

Discrete probability distributions, Discrete probability distributions ,17-3 – HP 50g Graphing Calculator User Manual

Page 552

background image

Page 17-3

Random number generators, in general, operate by taking a value, called the
“seed” of the generator, and performing some mathematical algorithm on that
“seed” that generates a new (pseudo)random number. If you want to generate
a sequence of number and be able to repeat the same sequence later, you can
change the "seed" of the generator by using function RDZ(n), where n is the
“seed,” before generating the sequence. Random number generators operate
by starting with a "seed" number that is transformed into the first random
number of the series. The current number then serves as the "seed" for the next
number and so on. By "re-seeding" the sequence with the same number you
can reproduce the same sequence more than once. For example, try the
following:
RDZ(0.25)

`

Use 0.25 as the "seed."

RAND()

`

First random number = 0.75285…

RAND()

`

Second random number = 0.51109…

RAND()

`

Third random number= 0.085429….

Re-start the sequence:
RDZ(0.25)

`

Use 0.25 as the "seed."

RAND()

`

First random number = 0.75285…

RAND()

`

Second random number = 0.51109…

RAND()

`

Third random number= 0.085429….

To generate a sequence of random numbers use function SEQ. For example, to
generate a list of 5 random numbers you can use, in ALG mode:
SEQ(RAND(),j,1,5,1). In RPN mode, use the following program:

«

n « 1 n FOR j RND NEXT n LIST » »

Store it into variable RLST (Random LiST), and use

J5@RLST! to produce a

list of 5 random numbers.

Function RNDM(n,m) can be used to generate a matrix of n rows and m
columns whose elements are random integers between -1 and 1(see Chapter
10).

Discrete probability distributions

A random variable is said to be discrete when it can only take a finite number
of values. For example, the number of rainy days in a given location can be
considered a discrete random variable because we count them as integer
numbers only. Let X represent a discrete random variable, its probability mass