www.piclist.com/techref/microchip/math/index.htm?key=random

BY : Peter L. Peres email (remove spam text)

On Fri, 13 Nov 1998, Dave VanHorn wrote:

> > Getting a feel for my tools.

> > ? A.Is it possible to generate RANDOM equally weighted numbers

> > (0-255)on a pic and any simple solutions?

>

> PN generators are easy to implement, it kind of depends on what you mean

> by random. a 38 bit maximal length PN generator would be pretty hard to

ANY N bit maximal length generator is EASY to predict because it is

guaranteed that each output combination occurs exactly once in a complete

cycle thus you know the next one immediately. Of course you also need to

tell the interested party that it is 38 bit long and complete. There

aren't that many algorythms that an interested party can't try them all

out while you sleep on your laurels.

> predict. The only number you don't get is all 38 bits=0, but if you take

> a 16 or 32 bit sample, you'll get all possible values in equal

> probability.

Hrrmph. See above. Ok, it takes a determined attacker to do it, but it

also depends on what is being protected against whom.

Non-maximal and sub-optimal PRNGs are far better at staying unknown. For

example two different 31 bit PRNG algorythms operating alternately on the

same register and using a certain fraction of the input as output is

better imho. It is far more difficult to do probability calculations on

this system than on the previous one. I think that thi is a distinct

advantage ;)

Peter

In reply to: <364CD531.9A4F8495@cedar.net>

See also: www.piclist.com/techref/microchip/math/index.htm?key=random