How do I get random #s?

Norman Diamond diamond at diamond.csl.sony.junet
Thu Feb 16 13:56:04 AEST 1989


> > geez...my favorite random number generator on a similar hardware vein is
> >  use the noise off of a cheap transistor, fed into a counter register...

> I would not expect this to be a good random number generator --
> can expect a fair amount of correlation between subsequent numbers.

True.  And xor'ing with software computations is better.

> ...And if you use a combined hardware/software solution, then
> you lose the repeatability that setting a seed in a purely
> "software" solution gives you.
> For example, we frequently use random numbers to test software,
> using the random numbers to choose from the various commands that
> our software implements, with randomly selected parameters,
> in random order.  Its very nice to use this technique to 
> find software bugs, fix the bugs, then re-run the random command
> generator software with the same seed as a regression test.
> Can't do this with a combined hardware/software scheme.

You can, by making a database of your random numbers.

It all comes down to this:  our real need is for a stream of numbers that
appears random to the program or naive user, but is reproducible on demand.
This is like asking whether an operating system should provide for tasks to
communicate or to compete.  The answer is both.
Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp at relay.cs.net)
  The above opinions are my own.   |  Why are programmers criticized for
  If they're also your opinions,   |  re-inventing the wheel, when car
  you're infringing my copyright.  |  manufacturers are praised for it?



More information about the Comp.lang.c mailing list