Code Monkey home page Code Monkey logo

randomizing-algorithm's Introduction

randomizing-algorithm

  • Computer generated random numbers are actually pseudo random numbers, actually generated by an algorithm

  • This algorithm does generate varying numbers, but some are repeated more than others

  • Works better for larger number ranges, for small ranges not all numbers are generated

  • Important: This algorithm IS predictable and not meant for actual use. It will generate varying numbers that may appear to be random, but the are predictable.

  • Also, I have written prototype algorithm that will randomize the list using the same algorithm rather than shuffling it, which is less predictable, see stats below

how it works

  • Makes a list of all the integers in the given range
  • Shuffles the list a few times by pushing all the numbers down by 1. The last number is moved to the start. Every 5 number generations, the program will push the list a few times.
  • Picks an algorithm determined number from the list

Stats

Generations taken for full coverage

  • As shown, the both our algorithm's and our prototype algorithm's coverage times are quite comparable to the random module's, but still are far from the theoretical best

Values generated compared

  • Like those generated by the random module, the numbers generated are scattered

Values generated by algorithm

  • Though the values are mostly scattered, some things should be noted
    • All values will eventually appear, since the list is being shuffled, but some will appear more than others, and it will take time for all of the numbers to appear
    • Distinct parabolic shapes can be observed left-top, middle-top, and middle-right.

Values generated by Random module

  • Unlike our algorithm's generations, no significant and reeating pattern can be observed in the random module's generations

Testing

  • Testing is undergoing to figure out the most efficient number of shuffles per cycle. See a clip below.

Prototype algorithm

  • Our Prototype algorithm randomizes the list using the same random picking algorithm rather than shuffling it.
  • Is less predictable than original algorithm and has few observable patterns.
  • It should be noted that prototype algorithm is much slower because when it randomizes it has to do a full scan, search, and list append.

randomizing-algorithm's People

Contributors

skparab1 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.