Coder Social home page Coder Social logo

xkcd221's Introduction

Xkcd221.jl

A hyper-fast truthful implementation of XKCD-221 PRNG compatible with Julia Random API.

If you do not know, now you know.

xkcd221

Usage

In your tests, simply initialize an RNG with a given seed, and use it instead of the default provided one, e.g.

julia> using Xkcd221

julia> rng = Xkcd221RNG()
Xkcd221RNG(0x0000000000000004)

julia> rand(rng, Int)
4

julia> rand(rng, Int, 3, 3)
3×3 Matrix{Int64}:
 4  4  4
 4  4  4
 4  4  4

julia> @benchmark rand($rng, UInt32)
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
 Range (min  max):  2.653 ns  22.204 ns  ┊ GC (min  max): 0.00%  0.00%
 Time  (median):     2.656 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   2.667 ns ±  0.256 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

    ▅ ▇  █ ▄  ▂ ▁ ▁              ▆ ▇  ▅ ▂    ▁               ▂
  █▁█▁█▁▁█▁█▁▁█▁█▁█▁▁▆▁▄▁▁▃▁▆▁▇▁▁█▁█▁▁█▁█▁▁█▁█▁▆▁▁▅▁▄▁▁▅▁▆▁▄ █
  2.65 ns      Histogram: log(frequency) by time     2.68 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

Acknowledgments

Thanks to Rafael Fourquet for his work on Julia Random API.

xkcd221's People

Contributors

wildart avatar

Stargazers

Henrik Wolf avatar ebigram avatar Daniel VandenHeuvel avatar Joe Greener avatar Andrés Riedemann avatar Abhimanyu Aryan avatar Rafael Fourquet avatar Soc Virnyl S. Estela avatar Guillaume Dalle avatar Moritz Schauer avatar Mosè Giordano avatar

Watchers

 avatar

xkcd221's Issues

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.