element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Back to Analog
  • Challenges & Projects
  • Project14
  • Back to Analog
  • More
  • Cancel
Back to Analog
Blog Pseudo random number generator
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Back to Analog to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: kk99
  • Date Created: 14 Oct 2018 7:18 PM Date Created
  • Views 12660 views
  • Likes 16 likes
  • Comments 10 comments
  • backtoanalogch
  • rng
  • random_number_generator
Related
Recommended

Pseudo random number generator

kk99
kk99
14 Oct 2018
image

Back to Analog

Enter Your Electronics & Design Project for a chance to win a $100 Shopping Cart!

Back to The Project14 homepage image

Project14 Home
Monthly Themes
Monthly Theme Poll

 

image

The basic idea was to create simple circuit with usage transistors, 4000 and 74HC series integrated circuits. I have created 3 bit random number generator with graphical presentation. Below there is logic circuit of this PRNG:

image

We have here 3 bit shift register which input is feed from XOR gate which is connected to two outputs from this register. It allows to generate number from range 1-7 in according to clock signal. To get here better random sequence you could use generator based on avalanche noise. Here is example circuit: Random Sequence Generator based on Avalanche Noise .

The XOR gate was created with usage of three gates OR, NAND and AND. Here is logic circuit for this XOR gate:

image

This XOR gate was implemented with usage of NPN transistors. We need six NPN transistors and nine resistors for create this gate. Below there is schematic of this gate:

image

Below there is schematic of whole circuit:

image

We have here CD4047 IC used to generate clock. It is configured to work as astable multivibrator with free running. I have chosen resistor R and capacitor C to get 9 Hz frequency. This clock drives 74HC164 shift register which is used to generate pseudo random number. Inputs of shift register are connected to ouput from XOR gate. XOR gate is connected to switch to initiate a number generation because by default all outputs of shift register have LOW value at inital state. I have used a HP 5082-7356 display which have BCD input and allows to latch input value. Because we have 3 bit output from shift register the MSB of BCD input is connected to GND. It allows to display number from range 0 - 7. The button connected to pin number 5 of this display is used to latch a number generated by pseudo random generator. All circuit is powered by 5 voltage generated by LM7805 linear voltage regulator.

Here is short video presentation of this circuit:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply

Top Comments

  • jw0752
    jw0752 over 6 years ago +5
    Hi kk99, This is a very interesting build. Thank you for sharing your build and thought process. Can you explain the purpose of the two buttons which I see are labeled start and latch in your schematics…
  • kk99
    kk99 over 6 years ago in reply to jw0752 +5
    Thank you John. HP display have latch memory. When you set low voltage on pin number 5, it loads a current value from input to memory and displays it. So, I use it to display number from pseudo generator…
  • afmishaq
    afmishaq over 6 years ago +5
    Simple but instructive project! The idea of making an XOR with three gates is also interesting. I assume it will continue to repeat the same sequence over and over.
  • afmishaq
    afmishaq over 6 years ago in reply to kk99

    Sure, I understand.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • kk99
    kk99 over 6 years ago in reply to afmishaq

    Thank you. I totally agree with you. I treat this simple design as example for learning purposes. Of course we could make a improvement it e.g. by using three different clocks for each bit with switching between these clocks based on another clock.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • afmishaq
    afmishaq over 6 years ago in reply to kk99

    You are right. But I was thinking more in terms of pseudo random number generation. The simple difference between the two is being deterministic or not. True random number generation is non-deterministic. Pseudo random numbers, on the other hand follow a deterministic sequence, as you have shown in your post. If the sequence is easily predictable, then it is not sufficiently random. The strength of a pseudo random number generator lies in the length of the (repeating) sequence and the complexity of its prediction. My suggestion was to provide a simple way to improve both. As long as the sampling frequency does not have a harmonic relationship with the multivibrator frequency, it should meet both requirements.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • kk99
    kk99 over 6 years ago in reply to afmishaq

    I think that to get true random generated number the best option is to create a avalanche noise generator and connect it to input of shift register.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • afmishaq
    afmishaq over 6 years ago in reply to kk99

    A simple way to prevent the repeating of the same sequence could be to use another free running multivibrator with a different frequency and XOR it with one of the outputs to form the new input.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube