Can you help with a simple generator for a random series of

Ken Smith wrote:
In article <10pdphldufn0mb0@corp.supernews.com>,
Guy Macon <http://www.guymacon.com> wrote:
[...]
I had just hit send when it occured to me that your application is
a perfect match for filling all of memory with output instructions,
each putting out a pre-chosen random number.

This sort of idea works quite well. I've used it. There is a little
trick that makes the sequence even longer. If instead of simply
outputting the value from the memory, the values are used in a running
sum the sequence length can be at least doubled.
That's a nice trick!

I think I can do even better.

Fill memory with instructions that XOR a preloaded random values
into the accumulator then outputs the result (or XORs the preloaded
random value with the context of the output port if the chip allows).
Tweak a bit here and a bit there so that each time it goes through
the loop the accumulator is Decimal 149 / Hex 95 / Binary 10010101
larger (with overflow modulo 256). 149 is a prime, so it won't
repeat until the 256th loop.

Here are the first 8 values that will be XORed into the results
on the first 8 loops through memory:

10010101
00101010
10111111
01010100
11101001
01111110
00010011
10111011

(This is all off the top of my head, so forgive me if I made an error.)
 
On Sun, 14 Nov 2004 18:49:13 -0600, John Fields
<jfields@austininstruments.com> wrote:

On Sun, 14 Nov 2004 23:32:44 +0000, Guy Macon
http://www.guymacon.com> wrote:


John Fields wrote:

pre-chosen random number.
^^^^^^^^^^^^^^^^^
funny!

Why so? That's the correct term for a table filled with
numbers that were generated by a random number generator.

---
The output of which may or may not be random, depending on how they're
pre-chosen and/or how the table's accessed. Just the term
"pre-chosen" smacks of planning, which is anathema to true randomness.

Consider this 5 bit pseudorandom sequence:

00 00000
01 10000
02 01000
03 00100
04 10010
05 01001
06 10100
07 11010
08 01101
09 00110
10 10011
11 11001
12 11100
13 11110
14 11111
15 01111
16 00111
17 00011
18 10001
19 11000
20 01100
21 10111 <--- 10110 Ooops...
22 11011
23 11101
24 01110
25 10111
26 01011
27 10101
28 01010
29 00101
30 00010
31 00001

Now consider that you're going to randomly "pre-choose" numbers from
the sequence and write them to a table which you'll index linearly,
and that the sequence you'll use to randomly select the table entries
is:

00
31
30
17
03
29
09
16
02
.
.
.


Now,fill in the values next to the sequence numbers for a chuckle :)
--
John Fields
 
If you're interested in theory, still one of the best works is Donald
Knuth's "Seminumerical Algorithms," Vol. 2 of his series. The first
chapter of Vol. 2 is devoted to generating and testing (pseudo)random
numbers.

The Xilinx app note (APP052) is still a concise reference for LFSR taps
up to a very long length.

And for true random bits, you can't beat Hotbits --
http://www.fourmilab.ch/hotbits/

"Anyone who considers arithmetical methods of producing random digits
is, of course, in a state of sin."

--John Von Neumann, 1951


In article <mj0gp0hktqdjnvfsg42t65qpp7apmctg6v@4ax.com>, John Fields
<jfields@austininstruments.com> wrote:

On Sun, 14 Nov 2004 18:49:13 -0600, John Fields
jfields@austininstruments.com> wrote:

On Sun, 14 Nov 2004 23:32:44 +0000, Guy Macon
http://www.guymacon.com> wrote:


John Fields wrote:

pre-chosen random number.
^^^^^^^^^^^^^^^^^
funny!

Why so? That's the correct term for a table filled with
numbers that were generated by a random number generator.

---
The output of which may or may not be random, depending on how they're
pre-chosen and/or how the table's accessed. Just the term
"pre-chosen" smacks of planning, which is anathema to true randomness.

Consider this 5 bit pseudorandom sequence:

00 00000
01 10000
02 01000
03 00100
04 10010
05 01001
06 10100
07 11010
08 01101
09 00110
10 10011
11 11001
12 11100
13 11110
14 11111
15 01111
16 00111
17 00011
18 10001
19 11000
20 01100
21 10111 <--- 10110 Ooops...
22 11011
23 11101
24 01110
25 10111
26 01011
27 10101
28 01010
29 00101
30 00010
31 00001

Now consider that you're going to randomly "pre-choose" numbers from
the sequence and write them to a table which you'll index linearly,
and that the sequence you'll use to randomly select the table entries
is:

00
31
30
17
03
29
09
16
02
.
.
.


Now,fill in the values next to the sequence numbers for a chuckle :)
--
 

Welcome to EDABoard.com

Sponsor

Back
Top