This project provides PRNG functions with a set of Controllers for generating pseudo-random values using a seed-based approach and various algorithms
npm install toosoon-prng-controllersThis project provides a PRNG functions with a set of Controllers for generating and manipulating pseudo-random values using a seed-based approach and various algorithms.
It adds additionnal features to the main library: toosoon-prng.

Yarn:
``properties`
$ yarn add toosoon-prng-controllers
NPM:
`properties`
$ npm install toosoon-prng-controllers
`ts
import { IntController, IntGroupController } from 'toosoon-prng-controllers';
const config = {
count: new IntController('count', 0, 10),
counts: new IntGroupController('counts', 5, 10)
};
console.log(config.count.getValue()); // Pseudo-random integer in the interval [0, 10]
for (let i = 0; i < 5; i++) {
console.log(config.counts.getValueAt(i)); // Pseudo-random integers in the interval [5, 10]
}
`
Generate pseudo-random boolean value.
`ts`
class BooleanController(seed: string | number, probability?: number);
Generate pseudo-random sign value (-1 or 1).
`ts`
class SignController(seed: string | number, probability?: number);
Generate pseudo-random floating-point number within a specified range.
`ts`
class FloatController(seed: string | number, min?: number, max?: number);
Generate pseudo-random integer number within a specified range.
`ts`
class IntController(seed: string | number, min: number, max: number);
Generates pseudo-random hexadecimal color.
`ts`
class HexColorController(seed: string);
Pick a pseudo-random item from a given array.
`ts`
class ItemController
Pick a pseudo-random property value from a given object.
`ts`
class ObjectPropertyController
Select a pseudo-random index from an array of weighted items.
`ts`
class WeightsController
Generate a pseudo-random number fitting a Gaussian (normal) distribution.
`ts`
class GaussianController(seed: string | number, mean?: number, spread?: number);
Group Controllers manage multiple instances of individual controllers.
Manage multiple BooleanController.
`ts`
class BooleanGroupController(seed: string | number, probability: number);
Manage multiple SignController.
`ts`
class SignGroupController(seed: string | number, probability: number);
Manage multiple FloatController.
`ts`
class FloatGroupController(seed: string | number, min: number, max: number);
Manage multiple IntController.
`ts`
class IntGroupController(seed: string | number, min: number, max: number);
Manage multiple HexColorController.
`ts`
class HexColorGroupController(seed: string);
Manage multiple ItemController.
`ts`
class ItemGroupController
Manage multiple ObjectPropertyController.
`ts`
class ObjectPropertyGroupController
Manage multiple WeightsController.
`ts`
class WeightsGroupController
Manage multiple GaussianController.
`ts``
class GaussianGroupController
MIT License, see LICENSE for details.