Socket
Socket
Sign inDemoInstall

d3-random

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-random

Generate random numbers from various distributions.


Version published
Maintainers
1
Created

What is d3-random?

The d3-random package is part of the D3 (Data-Driven Documents) JavaScript library, which is primarily used for generating random numbers with specific statistical properties. This package is useful for simulations, animations, and generating sample data for testing or visualization purposes.

What are d3-random's main functionalities?

Uniform Distribution

Generates a random number following a uniform distribution. In the provided code, random numbers between 1 and 5 are generated.

const d3 = require('d3-random');
const randomUniform = d3.randomUniform(1, 5);
console.log(randomUniform());

Normal Distribution

Generates a random number following a normal (Gaussian) distribution. The code example creates a standard normal distribution with a mean of 0 and a standard deviation of 1.

const d3 = require('d3-random');
const randomNormal = d3.randomNormal(0, 1);
console.log(randomNormal());

Log-Normal Distribution

Generates a random number following a log-normal distribution. The code example uses a mean of 0 and a standard deviation of 1 for the underlying normal distribution.

const d3 = require('d3-random');
const randomLogNormal = d3.randomLogNormal(0, 1);
console.log(randomLogNormal());

Bates Distribution

Generates a random number following a Bates distribution, which is useful for simulating the average of samples from a uniform distribution. The code example averages 10 samples.

const d3 = require('d3-random');
const randomBates = d3.randomBates(10);
console.log(randomBates());

Irwin-Hall Distribution

Generates a random number following an Irwin-Hall distribution. The code example sums 10 samples from a uniform distribution.

const d3 = require('d3-random');
const randomIrwinHall = d3.randomIrwinHall(10);
console.log(randomIrwinHall());

Other packages similar to d3-random

Keywords

FAQs

Package last updated on 03 May 2017

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