Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] Random Number Generator

2011-01-08 by Chuck Hackett

> From: Jim Wagner
> 
> One of the common pseudo-random, non-deterministic schemes is to have
> a free-running timer. You just grab a value when you need a new
> "number". It will be non-deterministic but might not be truly random
> in the statistical sense. It will average to the median.

I don't think this is non-deterministic unless the time at which the sample the
timer is taken is subject to outside events (like receiving terminal input, etc.) or
the timer clock is derived from a separate (from the CPU) clock that is very
unstable.  

Using the processor clock, if you start the timer and then process cpu-only activity
for two weeks and then sample the timer it will always have the same value because
the timer and the code are running in lock step.

Remember, I said that I was looking for the random number at startup, implying that
it is before there are any external events available ...

One thing that might work is an R/C driven free-running timer.  If you wait a
relatively long time (long in terms of the relative clock speed relationship between
the R/C and CPU clock) and pick of the lower 8 bits it might be enough.
 
Cheers,

Chuck Hackett
"Good judgment comes from experience, experience comes from bad judgment"
7.5" gauge Union Pacific Northern (4-8-4) 844 http://www.whitetrout.net/Chuck

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.