External really random generator

Technoman

Senior Member
Hi,

I'm looking for an external random generator based upon transistor's noise. I have seen some, but I need one only supplied by a 4.5V battery.

It will be connected to a 20M input using ADC.
 

AllyCat

Senior Member
Hi.

Do you mean 20M or 20M2 ? In what format do you require the random numbers; Binary, Decimal or an "Analogue" value (if so, to what resolution). How many random values are required per second?

IMHO it will be difficult to get a truly random analogue value without any "bias". Probably better to emulate a "Maximal Length Feedback Shift Register" using (PICaxe) software, initialised by a simple (analogue-derived) seed.

Cheers, Alan.
 

hippy

Technical Support
Staff member
The xoroshiro128+ algorithm looks interesting for PRNG. Seems to be reasonably simple and fast with a period of 2128 and good distribution -

https://en.wikipedia.org/wiki/Xoroshiro128+

https://en.wikipedia.org/wiki/Xorshift

I suspect a simpler software PRNG additionally kicked along by some external 'noise' and/or time may be just as good as a pure external source but I am no expert in randomness. What one expects by way of 'randomness' probably dictates what is suitable and not.
 

elektriker

New Member
Hello Technoman.
I use the external random generator PRG 600 (price 20 EUR) by Ingenieurbüro Bergmann with Picaxe 08M2, 20x2 and with AVR microcontroller.
******** Internet: http://ibbergmann.org.
This random generator is very small and fast and generates reliable random numbers.

Many greetings from Germany!
 

srnet

Senior Member
Hello Technoman.
I use the external random generator PRG 600 (price 20 EUR) by Ingenieurbüro Bergmann with Picaxe 08M2, 20x2 and with AVR microcontroller.
******** Internet: http://ibbergmann.org.
This random generator is very small and fast and generates reliable random numbers.

Many greetings from Germany!
I think by 'reliable' you mean it generates and even spread of numbers.

If you were choosing a random number between 1 and 10, and the random number selected was '1' a thousand times in a row, is that a 'reliable' random number generator ?

The answer of course is yes, since however unlikley, it is possible.
 
Last edited:

fernando_g

Senior Member
If you really want to employ a reverse-biased BE junction as your noise generator, then that junction should be in avalanche mode.
For most common bipolar transistors, you are talking about 6 to 7 volts.

You could always use a charge pump circuit like the ICL7660 to step up the battery voltage.
 

Technoman

Senior Member
Thankx to all

Sorry, I should have more clearly express the need.

It came from of one of my student (15) disappointed by the Random block in Blockly. For her robot's software she is using a value to randomly change the direction of the robot after it encounters an obstacle in a maze (dumb luck strategy).

@AllyCat : the chips are old 20M. We need a binary 0/1 (right/left) value every 100/200 ms. 20M2 is an option as the timer can provide a seed.

@ hippy : implementing these PRNG might be tedious with Blockly

@fernando_g : right, 4.5V is not enough for that. We try to keep it simple, so a charge pump circuit at last.

After a quick look around, two ideas :
- based on ambient light : a LDR + resistor as a voltage divider to an ADC then keeping LSB of changes
- based on ambient noise : an electret microphone + preamplifier + Schmitt trigger feeding a digital input
 

hippy

Technical Support
Staff member
It came from of one of my student (15) disappointed by the Random block in Blockly.
It might be worth posting or checking the Blocky code because it could be the way she is using Blockly which is causing the problem.

As with PICAXE Basic, RANDOM affects the variable specified, uses it both as a seed and the next value. If that variable is altered elsewhere in the code it will limit the range of values stepped through, can degrade the randomness significantly.

The attached seemed to give a fairly random result when tested under simulation -

"LLLRLRRLLLRRRRLLRLLLLRLRRRRRLLRLRRRRRRLLLLLL"

For left-right decision making and the like it's usually not the randomness which is a problem, but the feel that it is not random. Randomness doesn't always feel natural and the challenge can be in forcing something to feel more natural than being more random.
 

Attachments

Technoman

Senior Member
@hippy

Numbers output by the PRG was a too predictable sequence for her taste. After checking, the variable was not used elsewhere.

The LDR and a resistor connected to an ADC works fine.

What is the purpose of the division in your program?
 
Top