0.1.3 • Published 4 years ago

@geronimus/random-int v0.1.3

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
4 years ago

randomInt( lowerBound, upperBound )

Generates a pseudo-random integer value between the bounds that you specify. (Both inclusive.)

If either number has a decimal part, it will be truncated.

Both bounds must be between Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER.

upperBound must be greater than lowerBound.

Examples

const randomInt = require( "@geronimus/random-int" );

const randomByteValue = randomInt( 0, 255 );

Parameters

lowerBound number

The smallest possible random value that can be produced.

upperBound number

The largest possible random value that can be produced.

Notes

This function uses Math.random() as a pseudo-random number generator.

Therefore, DO NOT use it for any purpose that must be cryptographically secure.