Socket
Socket
Sign inDemoInstall

@types/seedrandom

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/seedrandom

TypeScript definitions for seedrandom


Version published
Weekly downloads
519K
decreased by-3.07%
Maintainers
1
Weekly downloads
 
Created

What is @types/seedrandom?

@types/seedrandom is a TypeScript type definition package for the seedrandom library, which is used to create seeded random number generators. This allows for reproducible random number sequences, which can be useful in simulations, games, and other applications where predictable randomness is needed.

What are @types/seedrandom's main functionalities?

Creating a Seeded Random Number Generator

This feature allows you to create a random number generator that produces the same sequence of numbers each time it is initialized with the same seed. This is useful for reproducibility in tests and simulations.

const seedrandom = require('seedrandom');
const rng = seedrandom('my-seed');
console.log(rng());

Using Different Algorithms

Seedrandom supports different algorithms for generating random numbers. This example shows how to use the 'alea' algorithm.

const seedrandom = require('seedrandom');
const rng = seedrandom('my-seed', { algorithm: 'alea' });
console.log(rng());

Generating Random Numbers in a Range

This feature demonstrates how to generate random numbers within a specific range using a seeded random number generator.

const seedrandom = require('seedrandom');
const rng = seedrandom('my-seed');
const randomInRange = (min, max) => min + rng() * (max - min);
console.log(randomInRange(1, 10));

Other packages similar to @types/seedrandom

FAQs

Package last updated on 06 Jul 2021

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