Professional Documents
Culture Documents
by
1
CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY
Vidyanagar, Proddatur, Y S R District - 516362
CERTIFICATE
2
3
ACKNOWLEDGEMENT
It gives me a great sense of pleasure to present the BTech seminar report undertaken
during B. Tech. 4th Year.
I am very grateful to Prof. G. Sreenivasa Reddy, Head of the Department, for giving
me a chance to present this seminar.
I also do not like to miss the opportunity to acknowledge the contribution of all
dignitary Staff-members of Chaithanya Bharathi Institute of Technology for their kind
assistance and cooperation during the development of my Seminar report. Last but not the
least, I acknowledge my friends for their contribution in the completion of the seminar report.
Apart from the efforts of me, the success of this project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my gratitude
to the people who have been instrumental in the successful completion of this report.
4
ABSTRACT
Random Number Generators (RNGs) are an important building block for
algorithms and protocols in cryptography. They are paramount in the construction of encryption keys
and other cryptographic algorithm parameters. a new class of random-number generators is described,
based on a combination of the logical exclusive-or operation and the McLaren-Marsaglia mechanism.
It is suitable for any word length, requires no multiple-precision arithmetic, and contains no hard-to-
determine constants. Though no theory is available, numerical tests have shown it to be very
satisfactory. Execution time is less than twice that of standard congruential generators. Random
number generators (RNG) are essential components for security system. RNGs are used in sensitive
applications such as key generation and challenge-response based authentication. The most important
and difficult part of any cryptographic system is to generate secret keys of high randomness quality.
5
CONTENT
CHAPTER TITLE PAGE NO
1. INTRODUCTION 6
2. RELATED WORK 7-14
2.1 Generation
2.2 Working Through Algorithms
2.3 Working Through Chips
3. RANDOM NUMBER GENERATORS 15-19
3.1 Types of RNG’s
3.2 Characteristics of RNG’s
4. ANALYSIS AND APPLICATIONS 20-22
5. ADVANTAGES AND DISADVANTAGES 23
6. CONCLUSION 24
7. REFERENCES 25
6
CHAPTER 1
INTRODUCTION
A random number generator is a system that generates random numbers from a
true source of randomness. Often something physical, such as a Geiger counter, where the results are
turned into random numbers. Random Number Generators (or RNG's), what they are, and what they
do are key pieces of information that we all should know next time we scope out the game machines
in our favourite online casinos or whenever we play our games online. Misconceptions about RNG's
have led to myths on just about every game machine played in a casino.
When you look at a casino gaming machine, be it slots, video poker, or any other
thing you really like, what you have in front of you is simply something much like the computer
system you have at home. Your gaming machine will have a video screen, some buttons (or a lever)
you can press and play your game. The only difference is that the casino gaming machines are
designed for only one specific purpose - We're familiar with using our computers to check our e-mail,
surf the net, and write letters and papers for work. The gaming machine works like that, only that it
executes your game instead of working all those functions. Along with running your favourite casino
game, the gambling machines also an RNG.
The RNG is the part of the gambling machine's system responsible for generating the
combinations you see on the screen. It does this function as if in perpetuity even if the gaming
machine is on standby with no one playing it. It just keeps creating random sets of numbers within the
range of zero to approximately four billion. The outcome of this operation is used to select which
cards or symbols on the screen to display. the RNG uses a series of instructions and a mathematical
formula to generate the random numbers. The math behind it is not your average arithmetic but both
the mathematical formula and the set of instructions can and are tested to comply with standards of
fairness. Your casino gaming machines (and the games you play on Internet casinos) undergo routine
testing by Casino Control Boards or an independent technical system testing company. Unless you're
a really powerful psychic, then your answer is no. There have been so called slot systems that have
been claimed to give 100% profit but if one understands how an RNG works then we can honestly say
that these are just a hoax.
RNG's have brought us a new dimension of gaming since we can now design gaming
machines without the limit of the physical size the machine. We are now able to produce games that
have more bonuses, progressive jackpots that pile up to millions, and other fabulous winning
opportunities. Random number generators are the hearts of our modern gaming machines. The next
time you face a casino gaming machine you know what makes it tick.
7
CHAPTER-2
RELATED WORK
The modern, technological world we now live in is powered by numbers. Whether it
is the binary digits of ones and zeroes that are used by the central processing units of PCs and laptops,
or the complex codes used to encrypt data sent and received across the planet’s internet infrastructure,
numbers are an incredibly important part of our lives that often go overlooked.
Random number generators, or RNGs, are an integral part of most computer systems,
networks, and software, so much so that the microprocessor companies like Intel and AMD often
produce dedicated RNG chips for their systems in order to help computer systems deal with the
demand for randomly generated numbers for encryption and data processing.
But how do random number generators work, and what are they used for? Here we
are going to take a closer look at this important little-understood yet important part of the devices,
networks, and systems that we all use every day.
Random number generators, or RNGs, are an integral part of most computer systems,
networks, and software, so much so that the microprocessor companies like Intel and AMD often
produce dedicated RNG chips for their systems in order to help computer systems deal with the
demand for randomly generated numbers for encryption and data processing.
8
But how do random number generators work, and what are they used for? Here we
are going to take a closer look at this important little-understood yet important part of the devices,
networks, and systems that we all use every day.
The demand for random number generators goes back long before the advent of
modern technology, as far back as the ancient Babylonian civilization that used random numbers for
lotteries. Gambling and lotteries have used some form of random number generator to create a
random number completely by chance. The most basic form of an RNG is probably a dice. Rolling a
dice gives you a result that has been generated by chance, and people have been betting on these
results for millennia.
There are two basic methods for generating random numbers: physical methods such
as rolling a dice; and ‘pseudorandom’ methods that rely on complex computer algorithms to generate
numbers. Both methods can involve very complicated processes. Physical random number generation
may use the decay of radioactive elements or cosmic background radiation to generate numbers
outside of a computer. These methods are incredibly expensive and sometimes pose a danger to
operators and are used primarily by militaries, governments, and some large corporations.
The most common form of RNG is a pseudorandom number generator that relies
upon complex computer algorithms and numbers known as seeds or key values to produce seemingly,
or pseudo, random numbers. The numbers produced will seem to the observer to be entirely random,
yet the use of seed numbers or key values and algorithms can also be used to reproduce this exact
number.
9
2.1 Generation:
People have been using random numbers for millennia, so the concept isn't new.
From the lottery in ancient Babylon, to roulette tables in Monte Carlo, to dice games in Vegas, the
goal is to leave the end result up to random chance. but gambling aside, randomness has many uses
in science, statistics, cryptography and more. Yet using dice, coins, or similar media as a random
device has its limitations. because of the mechanical nature of these techniques, generating large
quantities of random numbers requires great deal of time and work. Thanks to human ingenuity, we
have more powerful tools and methods at our disposal.
Random number generation is a process which, often by means of a random number
generator, generates a sequence of numbers or symbols that cannot be reasonably predicted well
than by a random chance. Random number generators can be truly random hardware random-
number generators, which generate random numbers as a function of current value of some physical
environment attribute that is constantly changing in a manner that is practically impossible to model,
or pseudorandom number generators.
Various applications of randomness have led to the development of several different
methods for generating random data, of which some have existed since ancient times, among whose
ranks are well-known "classic" examples, including the rolling of dice, coin-flipping,
the shuffling of playing cards, the use of yarrow stalks (for divination) in the I Ching, as well as
countless other techniques. Because of the mechanical nature of these techniques, generating large
quantities of sufficiently random numbers (important in statistics) required much work and time.
Thus, results would sometimes be collected and distributed as random number tables.
Several computational methods for pseudorandom number generation exist. All fall
short of the goal of true randomness, although they may meet, with varying success, some of
the statistical tests for randomness intended to measure how unpredictable their results are (that is, to
what degree their patterns are discernible). This generally makes them unusable for applications such
as cryptography. However, carefully designed cryptographically secure pseudorandom number
generators (CSPRNGS) also exist, with special features specifically designed for use in
cryptography.
10
2. Apply that seed in a sequence of mathematical operations to generate the result. That result is
the random number.
3. Use that resulting random number as the seed for the next iteration.
4. Repeat the process to emulate randomness.
Now let's look at an example.
As for random number generator algorithms that are executable by computers, they date back
as early as the 1940s and 50s (the Middle-square method and Lehmer generator, for example) and
continue to be written today (Xoroshiro128+, Squares RNG, and more).
Let's create a JavaScript function that takes the initial values as arguments and
returns an array of random numbers of a given length:
11
In mathematics, the middle-square method is a method of generating
pseudorandom numbers. In practice it is not a good method, since its period is usually very
short and it has some severe weaknesses; repeated enough times, the middle-square method
will either begin repeatedly generating the same number or cycle to a previous number in the
sequence and loop indefinitely.
if the value of n is odd then there will not necessarily be a uniquely defined
'middle n-digits' to select from. Consider the following: If a 3-digit number is squared it can yield a
6-digit number (eg: 5402 = 291600). If there were to be a middle three digit that would leave 6 − 3
= 3 digits to be distributed to the left and right of the middle. It is impossible to evenly distribute
these digits equally on both sides of the middle number and therefore there are no 'middle digits.'
It is acceptable to pad the seeds with zeros to the left in order to create an even valued n-digit
(e.g.: 540 → 0540).
Example implementation
12
Testing a hardware random generator differs from testing a pseudo-random number
generator. In particular, if one knows the design of the generator one can tailor the tests to be
appropriate for that design. The intended application may also be important when selecting the tests.
On the other hand, some of the tests used for pseudo-random number generators aren't very useful
when applied to hardware random number generators.
Your random number generator might pass the test but this does not necessarily mean that
the generator is good.
Or your generator might fail the test but this does not necessarily mean that the generator
is bad.
A hardware random number generator uses a physical phenomenon such as electrical
noise from a resistor or semiconductor diode or the decay of a radioactive material for the initial
source of randomness. The electronic circuitry of the generator converts this noise to bits and then
assembles these into bytes or words for use by the computer.
13
Here is a picture of one of the commercial hardware random number generators
(from Protego in Sweden). This one plugs into the serial port of a computer. You can see the diode at
the right-hand end, which I presume is the noise generator. I presume that the rest of the circuitry is an
amplifier and limiter. This generator uses the computer’s serial port circuitry to digitize the random
noise.
Used for:
Experimental design
Statistical simulations
The major application is for encryption. One wants to generate a keyword that is hard
to guess and using a hardware random number generator is probably the most reliable way of doing
this. Hardware random number generators are also used for selecting winning numbers in lotteries. In
particular the New Zealand Lotteries Commission uses one for generating its Keno numbers.
Hardware random number generators are also used for designing for experiments on extra sensory
perception (ESP). One of the commercial generators was developed explicitly for this purpose. The
present-day hardware random number generators are really too slow for routine use in statistical
simulations although it might be very sensible to use them for cross-checking simulations using
pseudo-random number generators.
14
A hardware random number generator is different from a pseudo-random number generator,
which uses a formula for generating the numbers. so, we need a different approach to testing.
It is a physical device so analyses it like a physical device. then reasonably satisfactory tests are
possible. but we need to know about its internal structure.
Marsaglia has developed a series of statistical tests known as the Diehard
tests principally for testing pseudo-RNGs. In a certain sense, these do not constitute a formal test
since there are so many tests you must get some significant deviations. My approach is to run the
series of tests and look by eye for groups of significant deviations or for single extremely significant
deviations.
George Marsaglia released a CD-ROM of random numbers which included series
from 3 hardware generators. He claimed that none passed his Diehard tests. One of the hardware
generators was the Tundra/New bridge generator that I have tested extensively and the reason it
failed was a programming or data handling error. More about this later. But I think this may have
tended to discredit hardware generators.
15
CHAPTER-3
RANDOM NUMBER GENERATORS
3.1 Types of RNG’s:
16
Where:
a = Multiplier
c = Increment
m = modulus
To generate Uniform Random Numbers, we use the equation:
According to Hull-Dobell theorem, Linear Congruential Generator whose cycle length is m, has full
Some of the application systems require longer period length due to the increase in
complexity of the system. Hence two or more multiplicative congruential generators are combined to
achieve this. Let the nth output from k different multiplicative Congruential Generators be Xn1, Xn2,
……. Xnk.
Therefore, Xj is defined as:
Xn+1, j =(ajXn + cj) mod mj, Where;
mj = prime modulus
aj = multiplier
c = increment
Random Number Streams
Random Number Stream refers to the starting seed taken from the sequence X 0, X1 …….
Xp. and considering ‘b’ values apart and the Stream ‘i’ could be defined by starting seed i.e.
Si = X b(i – 1)
Seed is an integer value that initializes Random Number Sequence for a Generator. If the
17
3.2Characteristics of RNG’s:
3.1 Distribution
Probably the most fundamental characteristic of a sequence of numbers is its distribution. The
PRNGs in the Thin Air library (with a few exceptions) produce uniformly distributed number
sequences. Other distributions include normal, Poisson, geometric, binomial, and student-t. Other
authors have published algorithms that convert uniformly distributed number sequences into other
distributions.
3.2 Range
Another fundamental characteristic of a random number sequence is its range. What is the
smallest number in the sequence? What is the largest? These two numbers define the range of the
whole sequence. The range of a sequence is more important and more subtle than most people realize.
If the range of a random number sequence is 0 to 64, it is useless for generating random percentages.
One good example of a bad range problem appears in some simple card games. In these examples, a
16-bit random number generator is used to choose a layout of a deck of cards. The problem lies in the
fact that the generator can produce at most 65,536 different numbers. A deck of cards can produce
80.66 * 1066 different layouts. If you are very careful in your use of the generator, this problem is
solvable. If not, most of the possible layouts never occur.
3.3 Type
Another useful characteristic of a random sequence is its type. What kind of numbers make up
this sequence? Are we talking about bits, integers, floating point numbers, strings, or something else
entirely? Most of these types can convert into each other relatively easily. In general, PRNGs fall into
three categories:
1. PRNGs that generate a sequence of integers.
2. PRNGs that generate a sequence of floating-point numbers between 0.0 and 1.0.
3. PRNGs that generate a stream of bits.
3.4 Period
All algorithm-based PRNGs repeat if they are allowed to run for long enough. This is caused
by the fact that the generator has a finite amount of internal state, and by the fact that an algorithm
cannot produce truly random output. Since we know the sequence must repeat, we would obviously
like to have it repeat after as long a time as possible. The number of individual numbers generated by
the PRNG before it begins to repeat is known as the period of the sequence. This sequence of
numbers is often called a cycle. The amount of internal state retained by a PRNG defines the upper
limit on the period. A PRNG with a period equal to the maximum predicted by its internal state is
sometimes called a maximal-period generator.
Depending on the algorithm used, a PRNG may actually generate more than one cycle. The
more individual cycles a generator has, the shorter the period each cycle has. The best generator
18
would, of course, have a single cycle that was longer than we could ever use (effectively infinite).
Some multiplicative congruential random number generators have two cycles, one being very long
(approximately 232-1 numbers in the sequence), the other being a cycle of period 1 at 0.
3.5 Coverage
The term coverage describes how well a given sequence covers its output range. For example,
a PRNG with an output range of 0 to 2 32-1 should generate every number between 0 and 2 32-1 if
allowed to run for long enough. Not all PRNGs cover their entire output range.
If a PRNG has multiple cycles, the coverage issue is even more interesting. The generator may
actually be capable of covering the whole range of output values. However, only certain values are
covered in each cycle. The multiplicative congruential PRNGs mentioned above have a maximum
coverage one less than expected in the main cycle. This is because an output of zero is never part of
the main cycle.
Many tests have been devised to study coverage. Two of these are the equidistribution,
or frequency, test and the gap test. The equidistributional test tries to verify that all of the numbers in
the sequence are equally likely. The gap test studies the probabilities of gaps of different sizes
between numbers in a particular range.
3.6 Runs
One interesting characteristic of a sequence of numbers concerns runs. When each successive
number in a subsequence is larger than the previous number, we have a run up. When each successive
number in a subsequence is smaller than the previous number, we have a run down. In a good random
sequence, we would expect the number of runs up to be pretty close to the number of runs down. We
would also expect that longer runs would be less likely than shorter runs.
3.7 Serial Correlation
A good sequence of random numbers should not have any correlation between successive
numbers. This means that you should not be able to predict the next number in the sequence by
looking at previous numbers. The classic example of serial correlation in a PRNG is the linear
congruential generator. When a linear congruential PRNG is used to generate pairs of numbers for use
as x, y coordinates on a graph, a pattern often shows up in the graph. The pairs of numbers tend to fall
on a set of parallel lines on the graph. This artifact is a simple result of the algorithm used.
One way to test for high serial correlation is the Poker test. The Poker test looks at the combinations
of five successive numbers taken from the sequence. These numbers are analysed for pairs, three-of-a-
kind, full house, etc. The probabilities of these combinations should approach that of a random
number stream.
19
3.8 Permutations
In a truly random number stream, any permutation of a set of numbers is as likely as any other
permutation of the same numbers. If one permutation of a set of numbers is more likely than another,
a few numbers in the set may supply enough information to help predict following numbers.
3.9 Spectral Characteristics
Even if a sequence of numbers does not exhibit any obvious patterns, it may have higher
order artifacts. A truly random sequence would have no particular frequency component more
pronounced than any other. Since any PRNGs must repeat after some length of time, there is at least
one dominant frequency component. Studying the spectral characteristics tells us if there are any
others.
20
CHAPTER 4
ANALYSIS AND APPLICATIONS
ANALYSIS:
Architecture of RNG
The system consists of modules namely:
o Sensor Module
o Generation Module
Sensor Module
This module is responsible for capturing data. Sensor acquires the data and provides an
interface to transfer the collected information to the computer. The sensor converts physical
Generation Module
In this module, the process of Post-processing happens where the data is binarized. This data is
21
Output Module
The output module accepts the binary data and stores it as a file. Random Number is generated using
this file and is displayed.
Let us consider RNG, that uses the randomness of Radioactive decay as an entropy source to
generate random numbers. According to Quantum Mechanics, the decay of atoms is random and
special type of counter called as Geiger Counter which detects ionizing radiation. Shift Registers are
and is controlled by the Microcontroller. The Microcontroller rotates the numbers inside the Register
which is around 10,00,000 numbers per second. When the Microcontroller detects the random event
(Radioactive particle), it terminates the rotation of numbers, reads the current number and stores
in Shift Register.
Shift Registers act as RAM for the system. The Shift Register accepts the input and shifts for every
clock cycle and outputs the data on LCD via serial port. Thus, sequence of numbers is generated and
22
APPLICATIONS:
Applications of Random Number Generator
The applications include:
23
CHAPTER-5
Advantages:
• Generating data encryption keys
Disadvantages:
• Time needed to gather the full list of a specific population
24
CHAPTER-6
CONCLUSION
25
CHAPTER-7
REFERENCES
26