New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@tstelzer/zufall

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tstelzer/zufall

Generate random values and noise.

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

Zufall

Generate random values and noise.

Installation

yarn add @tstelzer/zufall
# or
npm install @tstelzer/zufall

Usage

import makeRandom from '@tstelzer/zufall';

// Building with a static seed will
// always return predictable results ...
const random = makeRandom('SEED');

// Static seed value for reference.
random.seed; // 'SEED'

// Pseudo-random number (generic).
random.number(); // Always 0.8566100631751684
random.number(); // Always 0.09421503014329177

// Also exposes different implementations from the underlying RNG
// see https://github.com/davidbau/seedrandom for
// functionality beyond whats documented here.
random.number.alea();
random.number.xor128();
random.number.tychei();
random.number.xorwow();
random.number.xor4096();
random.number.xorshift7();
random.number.quick();

// Pseudo-random number with `n` digits.
random.digits(10) // Always 8709490569
random.digits(10) // Always 1847935272

// Pseudo-random number between min and max (both inclusive).
random.between(0, 100) // Always 86
random.between(0, 100) // Always 9
random.between(0, 100) // Always 99

// Open Simplex Noise.
// Note: Implementation is essentially copied from
// https://github.com/joshforisha/open-simplex-noise-js
// with two additions:
// 1. The internal RNG was replaced.
// 2. The public interface is functional instead of OO.
// 3. The `arrayND` methods have been omitted.
random.noise2D(0, 1) // Always -0.27409970004637957
random.noise3D(0, 1, 2) // Always -0.08090614886731362
random.noise4D(0, 1, 2, 4) // Always -0.3194015527038483

// Omitting a seed will generate practically
// unpredictable results every time.
const random = makeRandom();

Build locally

Clone repository.

git clone github.com/tstelzer/zufall

Install dependencies.

cd zufall
yarn
# or
npm install

Run test suite

Assuming you have cloned the repository and installed dependencies.

yarn test
# or
npm test

Keywords

noise

FAQs

Package last updated on 17 Mar 2019

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