Re: Random Integers


[Prev][Next][Index][Thread]

Re: Random Integers



On Thu, 4 Sep 1997 22:04:27 -0700, Hermann Chong <hchong@gonzaga.edu>
wrote:

>I am writing a program, and I added a random integer in it.  It stayed at
>one number, and I couldn't get it to be erratic.  How can I add that in?
>
>                                  Hermann Chong
>
>---
>
>If we were dolphins, we would call this planet Ocean.
>

Mmmmm, you are probably calling it with the same seed at the same
index number everytime.

True randomness is kinda hard to get. In fact, there is a science
tebate about the phenomenon of true randomness, whether it exists or
not. Computers are particularly bad at trying to look random. There
are some devices developed for computers that need to make random
numbers (such as encryption devices), and examples include satelite
feedback about the radio interference of the whole universe, and
current feedback on overheated diodes. The TI doesn't have all that,
and just like PCs, you are always limited to index seeded generators.

when you have such a generator, you supply a 'seed' number, and an
index. the result will be relatively random. However, with the same
seed and index number, you always get the same number.

usually, when you need a list, you specify one seed, and then increase
the index by one every time.

Most random number generating engines only take a seed and from then
on increase the index number by itself. perhaps yours doesn't. Or, if
you are writing one yourself (it's not clear from your post whether
you are trying to use one or make one), there are some examples. take
a look at them.


References: