SlideShare une entreprise Scribd logo
1  sur  12
Pseudorandom Numbers
-by Alex Roodman
Part 1: What does
“Pseudorandom” mean?
The word “Pseudorandom”
can be split into these two parts:
pseudo, random. The “random” part is
self explanatory, but then there is
“pseudo.”
“Pseudo” implies that it only
mimicks randomness. This is often bad for
random numbers, but some computer
programs require random numbers, such
as programs for reaction tests. You don’t
want someone to be able to predict what
they’re reacting to, and the given output
will still be generated by a computer.
Computers can’t do better that generate
pseudorandom numbers.
This presentation is about
different simple pseudorandom
number generators, and their
qualities. The results will be
presented via. histogram.
One quality of a
pseudorandom number generator is
that it is equally likely to be any
number in a specified range. If you
flip a coin several times, it’s equally
likely to be either heads or tails.
Another quality is how random
the changes in the numbers are. If you
count 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, the
number you count at any given moment
is equally likely to be any number from 1
to 10, but it’s still not random.
Part 2: How the Difference
works
Understanding the
first quality discussed in this
presentation is trivial: The
numbers need to be generated
about as often as each other.
The difference works differently,
though.
Imagine this: You are
rolling a fair die. First, you roll a 1.
The next number rolled is equally
likely to be any number from 1 to 6.
Thus, the difference between 1 and
the next number rolled is equally
likely to be 0, 1, 2, 3, 4, or 5. We
can make a small histogram of this,
repeated. For 2, the number can
change by -1, 0, 1, 2, 3, or 4. For 3,
we have -2, -1, 0, 1, 2, and 3, etc.
The histogram would look
like this:
Now we know
what to expect in the
difference of the
pseudorandom numbers.
-5
-4
-3
-2
-1
0
1
2
3
4
5
Generator #1
𝑔1 𝑥 ≡ e 𝑥
mod 1
If you take 𝑎 𝑥mod 𝑏,
(where both 𝑎 and 𝑏 are integers,)
and count 𝑥, then as long as 𝑎 and 𝑏
share no factors, you can get back
each number from 1 to 𝑏 − 1
exactly once before you get the
same number as before. Thus,
modular exponentiation is uniformly
distributed.
In simpler
words, if you multiply
a number by itself
several times, and
subtract another
number from it as
many times as
possible without going
below 0, you will get a
random number. This
is the method I tested
here.
Based on this, the
pseudorandom numbers
generated here will be well
distributed. The only problem that
could happen is if there is a bad
distribution of the differences of
numbers.
Testing
Generator #1
As you see below, the
distribution of the numbers only has a
few bumps in it. The distribution of the
differences is also in the triangle shape
that we wanted.
The only disappointment
is that the generator can’t generate
many numbers. If you do exactly
what the generator says, you can
only generate 31 numbers. If you
use a simpler way of calculating the
numbers, you can generate up to
713 numbers. This is a good
pseudorandom number generator,
but the calculations are just too
much for the computer.
= Difference
= Numbers Generated
Generator #2
𝑔2 𝑥 = sin2 𝑥
This function is
basically a wave that goes up
and down very quickly. One way
to represent this is taking a
spring, stretching it, and
flattening it sideways. You will
see a wave.
If you look at the
wave, you will see that it
stays at either the far top or
the far bottom for a bit
before it continues. This
could cause a problem with
the distribution.
Testing Generator #2
As expected,
the numbers are
generated more often
on the sides.
What’s curious,
though, is why the difference
in the numbers is always
around 0. This means that
the number generated
slowly travels back and forth,
between 1 and 0.
= Difference
= Numbers Generated
Generator #3
Imagine that you spin
a spinner, and it keeps spinning
forever. It keeps going at the
same speed all the time. It
takes 10 seconds to make a full
rotation, and there are 10
numbers total. Every 7
seconds, you write down what
number the spinner is over.
This is equally likely to be any
number on the spinner. We use
this concept in this generator.
The only thing that
might go wrong is the distribution
of the differences.
𝑔3 𝑥 ≡ 𝑒𝑥 mod 1
Testing Generator #3
The distribution of the
numbers generated is near perfect.
The distribution of the differences,
though, is a different matter. The difference between
the outputs can be exactly one of
two numbers. This is a little
disappointing, because we were
sort of relying on that for this to be
a good generator. The last generator
wasn’t that good, but at least it
could have a difference of more
than two numbers.
= Difference
= Numbers Generated
Generator #4
𝑔4 𝑥 ≡ ln 𝑥 mod 1 This generator is (spoiler alert) the
worst yet. It is intended, though, because using
this, you can see what bad qualities you don’t
want to see in a pseudorandom number
generator. The difference between the numbers
in this generator get smaller and smaller, and it
doesn’t even have a distribution.
Mathematicians, before you call this bogus, go
to
https://www.khanacademy.org/cs/pseudorand
om-number-generators/4733195911168000,
and look for something that says //Change to
try different generators. Look to the left of it,
and change the number in the brackets to 4.
Click restart, and watch.
Testing Generator #4
As expected, this wasn’t a very
good generator. The distribution of the
differences is basically a single spike,
The
distribution here, if you
keep generating
numbers, won’t ever
stay the same. By this,
we can’t tell whether
the distribution here is
even or spiky.
= Difference
= Numbers Generated
Conclusion
It seems that most of these generators
are terrible. The best one of them is too tough on
the computer, even though it works beautifully.
This shows how hard it is to
create these generators. One of the best
generators used is called the Mersenne
Twister. This generator is hard to
understand, and involves the
distribution of Mersenne Primes.
Making these good generators is
extremely difficult.

Contenu connexe

Tendances

Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationraksharao
 
Monte Carlo Simulation Of Heston Model In Matlab(1)
Monte Carlo Simulation Of Heston Model In Matlab(1)Monte Carlo Simulation Of Heston Model In Matlab(1)
Monte Carlo Simulation Of Heston Model In Matlab(1)Amir Kheirollah
 
The monte carlo method
The monte carlo methodThe monte carlo method
The monte carlo methodSaurabh Sood
 
High Dimensional Quasi Monte Carlo Method in Finance
High Dimensional Quasi Monte Carlo Method in FinanceHigh Dimensional Quasi Monte Carlo Method in Finance
High Dimensional Quasi Monte Carlo Method in FinanceMarco Bianchetti
 
Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...BIZIMANA Appolinaire
 
Understanding Statistics 2#2 The Normal Probability Distribution
Understanding Statistics 2#2 The Normal Probability DistributionUnderstanding Statistics 2#2 The Normal Probability Distribution
Understanding Statistics 2#2 The Normal Probability DistributionFlorin Neagu
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulationAnurag Jaiswal
 
My Math Project
My Math Project My Math Project
My Math Project du004008
 
Lecture: Monte Carlo Methods
Lecture: Monte Carlo MethodsLecture: Monte Carlo Methods
Lecture: Monte Carlo MethodsFrank Kienle
 
The use of Monte Carlo simulation in quantitative risk assessment of IT projects
The use of Monte Carlo simulation in quantitative risk assessment of IT projectsThe use of Monte Carlo simulation in quantitative risk assessment of IT projects
The use of Monte Carlo simulation in quantitative risk assessment of IT projectsEswar Publications
 
model simulating
model simulatingmodel simulating
model simulatingFEG
 
Smart Attacks on the integrity of the Internet of Things Avoiding detection b...
Smart Attacks on the integrity of the Internet of Things Avoiding detection b...Smart Attacks on the integrity of the Internet of Things Avoiding detection b...
Smart Attacks on the integrity of the Internet of Things Avoiding detection b...Communication Systems & Networks
 
Innovative Combat By Stoutheart
Innovative Combat By StoutheartInnovative Combat By Stoutheart
Innovative Combat By Stoutheartdkappes
 

Tendances (15)

Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generation
 
Monte Carlo Simulation Of Heston Model In Matlab(1)
Monte Carlo Simulation Of Heston Model In Matlab(1)Monte Carlo Simulation Of Heston Model In Matlab(1)
Monte Carlo Simulation Of Heston Model In Matlab(1)
 
The monte carlo method
The monte carlo methodThe monte carlo method
The monte carlo method
 
High Dimensional Quasi Monte Carlo Method in Finance
High Dimensional Quasi Monte Carlo Method in FinanceHigh Dimensional Quasi Monte Carlo Method in Finance
High Dimensional Quasi Monte Carlo Method in Finance
 
Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...Monte carlo integration, importance sampling, basic idea of markov chain mont...
Monte carlo integration, importance sampling, basic idea of markov chain mont...
 
Understanding Statistics 2#2 The Normal Probability Distribution
Understanding Statistics 2#2 The Normal Probability DistributionUnderstanding Statistics 2#2 The Normal Probability Distribution
Understanding Statistics 2#2 The Normal Probability Distribution
 
Monte carlo
Monte carloMonte carlo
Monte carlo
 
Monte carlo simulation
Monte carlo simulationMonte carlo simulation
Monte carlo simulation
 
My Math Project
My Math Project My Math Project
My Math Project
 
Lecture: Monte Carlo Methods
Lecture: Monte Carlo MethodsLecture: Monte Carlo Methods
Lecture: Monte Carlo Methods
 
The use of Monte Carlo simulation in quantitative risk assessment of IT projects
The use of Monte Carlo simulation in quantitative risk assessment of IT projectsThe use of Monte Carlo simulation in quantitative risk assessment of IT projects
The use of Monte Carlo simulation in quantitative risk assessment of IT projects
 
model simulating
model simulatingmodel simulating
model simulating
 
Smart Attacks on the integrity of the Internet of Things Avoiding detection b...
Smart Attacks on the integrity of the Internet of Things Avoiding detection b...Smart Attacks on the integrity of the Internet of Things Avoiding detection b...
Smart Attacks on the integrity of the Internet of Things Avoiding detection b...
 
Innovative Combat By Stoutheart
Innovative Combat By StoutheartInnovative Combat By Stoutheart
Innovative Combat By Stoutheart
 
Applied 40S March 3, 2009
Applied 40S March 3, 2009Applied 40S March 3, 2009
Applied 40S March 3, 2009
 

En vedette (6)

Simulation in terminated system
Simulation in terminated system Simulation in terminated system
Simulation in terminated system
 
Random variate generation
Random variate generationRandom variate generation
Random variate generation
 
Input modeling
Input modelingInput modeling
Input modeling
 
Pseudo Random Number Generators
Pseudo Random Number GeneratorsPseudo Random Number Generators
Pseudo Random Number Generators
 
Random Number Generation
Random Number GenerationRandom Number Generation
Random Number Generation
 
Generate and test random numbers
Generate and test random numbersGenerate and test random numbers
Generate and test random numbers
 

Similaire à Pseudorandom number generators powerpoint

Counting (Notes)
Counting (Notes)Counting (Notes)
Counting (Notes)roshmat
 
Thinking Like a Programmer
Thinking Like a ProgrammerThinking Like a Programmer
Thinking Like a ProgrammerCate Huston
 
6th grade math notes
6th grade math notes6th grade math notes
6th grade math noteskonishiki
 
Introduction to Genetic Algorithms with Python - Hello World!
Introduction to Genetic Algorithms with Python  - Hello World!Introduction to Genetic Algorithms with Python  - Hello World!
Introduction to Genetic Algorithms with Python - Hello World!Cℓinton Sheppard
 
Hunting primes (a caccia di primi) 27 ott 2014
Hunting primes (a caccia di primi)   27 ott 2014Hunting primes (a caccia di primi)   27 ott 2014
Hunting primes (a caccia di primi) 27 ott 2014Vincenzo Sambito
 
Skip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docx
Skip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docxSkip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docx
Skip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docxedgar6wallace88877
 
Measurements and error in experiments
Measurements and error in experimentsMeasurements and error in experiments
Measurements and error in experimentsAwad Albalwi
 
FS Maths Level 2- March 08, 2023 (Decimals).
FS Maths Level 2- March 08, 2023 (Decimals).FS Maths Level 2- March 08, 2023 (Decimals).
FS Maths Level 2- March 08, 2023 (Decimals).LeadAcademy3
 
Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.Questpond
 
Whole numbers and integers
Whole numbers and integersWhole numbers and integers
Whole numbers and integerselminadesmarais
 
Course project solutions 2018
Course project solutions 2018Course project solutions 2018
Course project solutions 2018Robert Geofroy
 
Converting with fractions, decimals, and percents
Converting with fractions, decimals, and percentsConverting with fractions, decimals, and percents
Converting with fractions, decimals, and percentsJyao711
 
2 coding101 fewd_lesson2_programming_overview 20210105
2 coding101 fewd_lesson2_programming_overview 202101052 coding101 fewd_lesson2_programming_overview 20210105
2 coding101 fewd_lesson2_programming_overview 20210105John Picasso
 
Interview questions slide deck
Interview questions slide deckInterview questions slide deck
Interview questions slide deckMikeBegley
 
44 randomized-algorithms
44 randomized-algorithms44 randomized-algorithms
44 randomized-algorithmsAjitSaraf1
 

Similaire à Pseudorandom number generators powerpoint (20)

Counting (Notes)
Counting (Notes)Counting (Notes)
Counting (Notes)
 
Procedural Description
Procedural DescriptionProcedural Description
Procedural Description
 
Thinking Like a Programmer
Thinking Like a ProgrammerThinking Like a Programmer
Thinking Like a Programmer
 
Buacm 3
Buacm 3Buacm 3
Buacm 3
 
6th grade math notes
6th grade math notes6th grade math notes
6th grade math notes
 
Introduction to Genetic Algorithms with Python - Hello World!
Introduction to Genetic Algorithms with Python  - Hello World!Introduction to Genetic Algorithms with Python  - Hello World!
Introduction to Genetic Algorithms with Python - Hello World!
 
Hunting primes (a caccia di primi) 27 ott 2014
Hunting primes (a caccia di primi)   27 ott 2014Hunting primes (a caccia di primi)   27 ott 2014
Hunting primes (a caccia di primi) 27 ott 2014
 
Skip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docx
Skip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docxSkip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docx
Skip To ContentOpen Quick LinksQuick LinksPage LandmarksCont.docx
 
Measurements and error in experiments
Measurements and error in experimentsMeasurements and error in experiments
Measurements and error in experiments
 
FS Maths Level 2- March 08, 2023 (Decimals).
FS Maths Level 2- March 08, 2023 (Decimals).FS Maths Level 2- March 08, 2023 (Decimals).
FS Maths Level 2- March 08, 2023 (Decimals).
 
Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.Most asked JAVA Interview Questions & Answers.
Most asked JAVA Interview Questions & Answers.
 
Let's Play a Game
Let's Play a GameLet's Play a Game
Let's Play a Game
 
Whole numbers and integers
Whole numbers and integersWhole numbers and integers
Whole numbers and integers
 
Course project solutions 2018
Course project solutions 2018Course project solutions 2018
Course project solutions 2018
 
Python Homework Help
Python Homework HelpPython Homework Help
Python Homework Help
 
Converting with fractions, decimals, and percents
Converting with fractions, decimals, and percentsConverting with fractions, decimals, and percents
Converting with fractions, decimals, and percents
 
2 coding101 fewd_lesson2_programming_overview 20210105
2 coding101 fewd_lesson2_programming_overview 202101052 coding101 fewd_lesson2_programming_overview 20210105
2 coding101 fewd_lesson2_programming_overview 20210105
 
When Random is too Random
When Random is too RandomWhen Random is too Random
When Random is too Random
 
Interview questions slide deck
Interview questions slide deckInterview questions slide deck
Interview questions slide deck
 
44 randomized-algorithms
44 randomized-algorithms44 randomized-algorithms
44 randomized-algorithms
 

Dernier

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Pseudorandom number generators powerpoint

  • 2. Part 1: What does “Pseudorandom” mean? The word “Pseudorandom” can be split into these two parts: pseudo, random. The “random” part is self explanatory, but then there is “pseudo.” “Pseudo” implies that it only mimicks randomness. This is often bad for random numbers, but some computer programs require random numbers, such as programs for reaction tests. You don’t want someone to be able to predict what they’re reacting to, and the given output will still be generated by a computer. Computers can’t do better that generate pseudorandom numbers. This presentation is about different simple pseudorandom number generators, and their qualities. The results will be presented via. histogram. One quality of a pseudorandom number generator is that it is equally likely to be any number in a specified range. If you flip a coin several times, it’s equally likely to be either heads or tails. Another quality is how random the changes in the numbers are. If you count 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, the number you count at any given moment is equally likely to be any number from 1 to 10, but it’s still not random.
  • 3. Part 2: How the Difference works Understanding the first quality discussed in this presentation is trivial: The numbers need to be generated about as often as each other. The difference works differently, though. Imagine this: You are rolling a fair die. First, you roll a 1. The next number rolled is equally likely to be any number from 1 to 6. Thus, the difference between 1 and the next number rolled is equally likely to be 0, 1, 2, 3, 4, or 5. We can make a small histogram of this, repeated. For 2, the number can change by -1, 0, 1, 2, 3, or 4. For 3, we have -2, -1, 0, 1, 2, and 3, etc. The histogram would look like this: Now we know what to expect in the difference of the pseudorandom numbers. -5 -4 -3 -2 -1 0 1 2 3 4 5
  • 4. Generator #1 𝑔1 𝑥 ≡ e 𝑥 mod 1 If you take 𝑎 𝑥mod 𝑏, (where both 𝑎 and 𝑏 are integers,) and count 𝑥, then as long as 𝑎 and 𝑏 share no factors, you can get back each number from 1 to 𝑏 − 1 exactly once before you get the same number as before. Thus, modular exponentiation is uniformly distributed. In simpler words, if you multiply a number by itself several times, and subtract another number from it as many times as possible without going below 0, you will get a random number. This is the method I tested here. Based on this, the pseudorandom numbers generated here will be well distributed. The only problem that could happen is if there is a bad distribution of the differences of numbers.
  • 5. Testing Generator #1 As you see below, the distribution of the numbers only has a few bumps in it. The distribution of the differences is also in the triangle shape that we wanted. The only disappointment is that the generator can’t generate many numbers. If you do exactly what the generator says, you can only generate 31 numbers. If you use a simpler way of calculating the numbers, you can generate up to 713 numbers. This is a good pseudorandom number generator, but the calculations are just too much for the computer. = Difference = Numbers Generated
  • 6. Generator #2 𝑔2 𝑥 = sin2 𝑥 This function is basically a wave that goes up and down very quickly. One way to represent this is taking a spring, stretching it, and flattening it sideways. You will see a wave. If you look at the wave, you will see that it stays at either the far top or the far bottom for a bit before it continues. This could cause a problem with the distribution.
  • 7. Testing Generator #2 As expected, the numbers are generated more often on the sides. What’s curious, though, is why the difference in the numbers is always around 0. This means that the number generated slowly travels back and forth, between 1 and 0. = Difference = Numbers Generated
  • 8. Generator #3 Imagine that you spin a spinner, and it keeps spinning forever. It keeps going at the same speed all the time. It takes 10 seconds to make a full rotation, and there are 10 numbers total. Every 7 seconds, you write down what number the spinner is over. This is equally likely to be any number on the spinner. We use this concept in this generator. The only thing that might go wrong is the distribution of the differences. 𝑔3 𝑥 ≡ 𝑒𝑥 mod 1
  • 9. Testing Generator #3 The distribution of the numbers generated is near perfect. The distribution of the differences, though, is a different matter. The difference between the outputs can be exactly one of two numbers. This is a little disappointing, because we were sort of relying on that for this to be a good generator. The last generator wasn’t that good, but at least it could have a difference of more than two numbers. = Difference = Numbers Generated
  • 10. Generator #4 𝑔4 𝑥 ≡ ln 𝑥 mod 1 This generator is (spoiler alert) the worst yet. It is intended, though, because using this, you can see what bad qualities you don’t want to see in a pseudorandom number generator. The difference between the numbers in this generator get smaller and smaller, and it doesn’t even have a distribution. Mathematicians, before you call this bogus, go to https://www.khanacademy.org/cs/pseudorand om-number-generators/4733195911168000, and look for something that says //Change to try different generators. Look to the left of it, and change the number in the brackets to 4. Click restart, and watch.
  • 11. Testing Generator #4 As expected, this wasn’t a very good generator. The distribution of the differences is basically a single spike, The distribution here, if you keep generating numbers, won’t ever stay the same. By this, we can’t tell whether the distribution here is even or spiky. = Difference = Numbers Generated
  • 12. Conclusion It seems that most of these generators are terrible. The best one of them is too tough on the computer, even though it works beautifully. This shows how hard it is to create these generators. One of the best generators used is called the Mersenne Twister. This generator is hard to understand, and involves the distribution of Mersenne Primes. Making these good generators is extremely difficult.