Git Product home page Git Product logo

random-primes's Introduction

Random Primes

Generate random primes p of length n bits such that.

2^(n-1) <= p <= 2^n - 1

Build

  1. Set the desired maximum length of the generated randoms. Defaults to 8196
// Random int of n bits.
const auto n_bits = 8192;
gcc main.cpp -O2 -Wall -std=c++14 -lstdc++ -lgmp -lgmpxx

Relies on /dev/urandom to get a random seed of size unsigned long int.

Run

Simply invoke executable with a desired bit length as an argument.

randomprime 8192

Profile

profile.py allows benchmarking random prime generation. For each lenght of n_bits in range [n_start, n_stop] the script will generate n_samples of random primes timing the generation of each sample. Mean sample generation time and standard deviation will then be saved into a csv file.

Unix tool time is used as a profiler. For runtimes less than 10 milliseconds time returns 0. Therefore it is not recommended to set the n_start bits to anything less than 1024 or you might see zeros in the resulting csv (depends on how fast is your computer).

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.