Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simpack

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpack

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Simpack

Code Climate Test Coverage

Simpack is your go-to gem for your simulation needs in Ruby. At its heart, Simpack is a linear congruential generator (LCG) which can then be used to generate random samples from a number of statistical distributions.

Use it for simulation, modeling, or games!

Installation

Add this line to your application's Gemfile:

gem 'simpack'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simpack

Usage

Simpack::LCG

#initialize
lcg = Simpack::LCG.new

Optionally, you may wish to configure your LCG to suit your preferences with an options hash:

lcg = Simpack::LCG.new({modulus: 8, multiplier: 5})

Keys for the options hash include the following:

  • :modulus
  • :multiplier
  • :increment
  • :seed

If you do decide to specify your own constants, all bets are off. Simpack (as of now) does not test for constraints of the Hull-Dobell Theorem, or any other tests of period or uniformity. This allows you to create a crappy LCG if you desire, but it will not alert you if you do.

See the Technical Specs section for details of the standard configuration.

#uniform

#uniform can be called with an optional argument specifying the number of random numbers to return.

> lcg.uniform
> 0.27662859533103207

> lcg.uniform(3)
> [0.9518568231847053, 0.7968659172399516, 0.15733885122680413]

Contributing

Want to add a new distribution? Have ideas for a feature? Spotted a bug? Contribute! I am especially looking for people who have a bit more statistical knowledge than I do to spot any potential problems with the code.

  1. Fork it ( https://github.com/johnochs/simpack/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

##Technical Specs

Simpack::LCG

Table of standard parameters:

ParameterValue
Modulus264
Multiplier6364136223846793005
Increment1442695040888963407
SeedTime.now.to_i

FAQs

Package last updated on 05 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc