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

powerball

v0.8.0

Published

My attempt at predicting powerball numbers with nodejs

Downloads

20

Readme

powerball

My attempt at predicting Powerball numbers with nodejs

npm version

See it in action here

command-line

I included the command powerball, if you install with npm install -g powerball that will predict/check numbers.

Usage: powerball [options] [numbers]

Options:
  -h, --help       Show help
  --count, -c      Count of number sets to return.              [default: 10]
  --powerplay, -p  For checking: did you enable powerplay?      [boolean]
  --time, -t       What time should the rules be pulled from?   [default: now]

Examples:
  powerball -c 5               Get 5 numbersto play
  powerball 01 18 41 43 46 22  See if your numbers got pulled in last draw

Objects

Statistical : object

Kind: global namespace

Statistical.μ(freq) ⇒ Number

Calculate arithmetic mean of ball-count

Kind: static method of Statistical
Returns: Number - Arithmatic Mean of weights

| Param | Type | Description | | --- | --- | --- | | freq | Object | A single ball-frequency array from frequencies |

Example (Get Arithmetic Mean of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.μ(f.red)) Example (Get Arithmetic Mean of White Balls)
console.log(powerball.mean(f.white))

Statistical.gmean(freq) ⇒ Number

Calculate geometric mean of ball-count

Kind: static method of Statistical
Returns: Number - Geometric Mean of weights

| Param | Type | Description | | --- | --- | --- | | freq | Object | A single ball-frequency array from frequencies |

Example (Get Geometric Mean of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.gmean(f.red)) Example (Get Geometric Mean of White Balls)
console.log(powerball.gmean(f.white))

Statistical.median(freq) ⇒ Number

Calculate median of ball-count

Kind: static method of Statistical
Returns: Number - Median of weights

| Param | Type | Description | | --- | --- | --- | | freq | Object | A single ball-frequency array from frequencies |

Example (Get Median of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.median(f.red)) Example (Get Median of White Balls)
console.log(powerball.median(f.white))

Statistical.range(freq) ⇒ Array

Calculate range of ball-count

Kind: static method of Statistical
Returns: Array - High/low range of numbers for weights.

| Param | Type | Description | | --- | --- | --- | | freq | Object | A single ball-frequency array from frequencies |

Example (Get Range of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.range(f.red)) Example (Get Range of White Balls)
console.log(powerball.range(f.white))

Statistical.σ(freq) ⇒ Number

Calculate standard deviation of ball-count

Kind: static method of Statistical
Returns: Number - Standard Deviation of weights

| Param | Type | Description | | --- | --- | --- | | freq | Object | A single ball-frequency array from frequencies |

Example (Get Standard Deviation of Red Balls)
var f = powerball.frequencies(winners) console.log(powerball.stddev(f.red)) Example (Get Standard Deviation of White Balls)
console.log(powerball.σ(f.white))

Powerball : object

Kind: global namespace

Powerball.balls([date]) ⇒ Array

Get ball-maxes for a given date

Kind: static method of Powerball
Returns: Array - white, red ball-max

| Param | Type | Default | Description | | --- | --- | --- | --- | | [date] | Date | now | Date to check |

Example (Current Ball Maxes)
// returns [69, 26] powerball.balls() Example (Old Ball Maxes)
// returns [59, 39] powerball.balls(new Date('1/8/2009'))

Powerball.numbers() ⇒ Promise

Get past winning numbers

Kind: static method of Powerball
Returns: Promise - Resolves to array of winner objects
Example (Get Current Numbers)
powerball.numbers().then(winners => { console.log(winners) })

Powerball.frequencies(winners) ⇒ Object

Calculate frequencies of white & red balls

Kind: static method of Powerball
Returns: Object - keyed with number, value is frequency

| Param | Type | Description | | --- | --- | --- | | winners | Array | The winning numbers from numbers |

Example (Get Frequency Counts)
console.log(powerball.frequencies(winners))

Powerball.predict(white, red, [time]) ⇒ Array

Predict winning numbers

Kind: static method of Powerball
Returns: Array - The numbers you should play

| Param | Type | Default | Description | | --- | --- | --- | --- | | white | Object | | White ball-frequency array from frequencies | | red | Object | | Red ball-frequency array from frequencies | | [time] | Date | now | Different dates have differnt ball-sets |

Example (Get Prediction)
var f = powerball.frequencies(winners) console.log(powerball.predict(f.white, f.red)) Example (Predict For an Old Date)
console.log(powerball.predict(f.white, f.red, new Date('1/1/98')))

Powerball.payout(pick, winner, powerplay) ⇒ Boolean | Number

Check if your numbers won (only current rules) http://www.powerball.com/powerball/pb_prizes.asp

Kind: static method of Powerball
Returns: Boolean | Number - true for jackpot, if Number: amount you won

| Param | Type | Description | | --- | --- | --- | | pick | Array | Your number picks (6-length array) | | winner | Object | A single draw from number() | | powerplay | Boolean | Did you mark power-play on your ticket? |

Example (Check If You Won)
powerball.numbers().then(winners => { console.log(powerbal.payout([5, 6, 10, 36, 43, 11], winners.pop(), true)) })