RNG will take one input from the user, generate a 4-bit output signal that
will be sent to a visual signal decoder, which will then display the output
(0 to 15) in visual form (with 7-segments LEDs).

The user input will be a mechanical input. For this project,
the user input will be from the pushing of the "generate" button.

The user interface is that whenever the user pushes the
"generate" button, a new random number ranged from 0 to 15 will be displayed
on the 7-segments LEDs. The LEDs should hold the current display until the
next user's input.

Design Basics:

If a random output is unreachable without a random input, all we need to
do is to add to the circuit an additional random input and the problem will
be solved. But now the problem becomes: how is it possible to add a random
input to the circuit? The remedy may be more simple than you think.

We can make use of the "human randomness" from the user.

When the user pushes the "generate" button, it is impossible for the
circuit to determine exactly at what time the input event will occur. In
other words, the exact time of the user's input event is unpredictable
and therefore random. Although it is possible to estimate
the time of the user's input accurate to the seconds or even milliseconds,
but it will be difficult to know exactly during which microsecond had the user's
input occurred. At least human will not be able to tell that small of a
time difference anyway.

Logic Designs:

In order to make use of the "human randomness" and to add a random input
to the circuit, we will need an oscillating signal of high frequency. We
will use a 1 MHz signal for this design. This signal can be used as a
clocking signal to a counter block so that the counter will be incremented
every 1 microsecond. And when the user input occur, the output of the
counter can be any number from 0 to 15. And since all outputs are of equal
probability, randomness is achieved. In this design, the counter block will
not be directly controlled by the user. But rather the user input will be
the load signal of a register which obtains its load value directly from the
counter block output. Thus, whenever the user pushes the "generate" button,
the register will load whatever value is currently being output by the
counter block. The register output will be the output of RNG, which may
then be decoded and displayed.

The output is to be a 4-bit number (0 to 15) and therefore a 4-bit
counter will be needed, as well as a 4-bit register.

RNG Basic Diagram & Symbol:

Basic Flow:

Simulation:

The following is built in Xilinx Foundation F2.1i, Build
3.1.162 Schematic Editor.

Schematic:

Waveform:

Summary:

The Random Number Generator proves that randomness can be
achieved in combinational and sequential circuits. By using a simple counter
circuit that changes values at a high frequency, it is possible to simulate
an unpredictable circuit output. RNG is built from only two major logic
blocks; it employs no complex algorithm or design and it's easy to use.