Skip to content

A pseudo random generator code based on Middle Square Method algorithm.

License

Notifications You must be signed in to change notification settings

santanu94/psudo-random-generator

Repository files navigation

pseudo-random-generator

A psudo random generator code based on Middle Square Method algorithm. The main code goes in the customPRG.py file. It has a function random() which accepts a numerical value(limit) as parameter, and generates a random number from 0 to ( limit - 1 ), both inclusive.

The code produces a seed file which helps in reducing chances of repetaton at the start for the same seed value.

How to use

  1. Download the customPRG.py file in the same folder as rest of the file using this one, or else help yourself with the path.
  2. import the class:
import customPRG
  1. create object for the class:
cmsm = customPRG.customMSM()
  1. get random number:
rnd = cmsm.random(30)

This returns a random number between 0 to 29.

About

A pseudo random generator code based on Middle Square Method algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages