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

@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

  • 3.0.2
  • ts3.8
  • ts3.9
  • ts4.0
  • ts4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
606K
decreased by-7.52%
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 10 Feb 2022

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