npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blum-blum-shub

v0.0.3

Published

Random number generator based on a formula using prime numbers.

Downloads

38

Readme

View on NPM View on Github View on Github

Blum Blum shub algorithm

Random number generator based on a formula using prime numbers.

How to use ?

Started by installing the package

  • In npm : npm install blum-blum-shub or npm install github:algorithmsjs/blum-blum-shub

  • In yarn : yarn add blum-blum-shub or yarn add github:algorithmsjs/blum-blum-shub

  • In pnpm : pnpm add blum-blum-shub or pnpm add github:algorithmsjs/blum-blum-shub

Documentation

Formula: Formula

Params

| Name | Type | | :------------: | :------------: | | p | Number | | q | Number | | seed | Number |

  • On JavaScript :
// Example
const bbs = require('blum-blum-shub');
const BBS = new bbs(9, 15, 7);

let i = 0;

while(i < 6) {
	// Get the next random number
	console.log(BBS.randomNumber());
	
	// Get the next random bit
	console.log(BBS.randomBit());
	
	i++;
}
  • On CoffeeScript :
# Example
bbs = require('blum-blum-shub')
BBS = new bbs(9, 15, 7)

 i = 0

while i < 6
	# Get the next random number
	console.log BBS.randomNumber()
	
	# Get the next random bit
	console.log BBS.randomBit()
	
	i++

...

Benchmark

  • randomNumber x 10,425,712 ops/sec ±0.86% (89 runs sampled)
  • randomBit x 10,280,317 ops/sec ±0.92% (90 runs sampled)
  • Fastest is randomNumber

Fact

Blum Blum Shub (BBS) is an algorithm capable of producing pseudo-random numbers. It was proposed in 1986 by Lenore Blum, Manuel Blum and Michael Shub1, hence its name.

Copyright 2020 FellGill