@js-random/number
    TypeScript icon, indicating that this package has built-in type declarations

    0.3.5 • Public • Published

    @js-random/number

    A simple and lightweight number randomizer for JavaScript (TypeScript friendly)

    Installation

    npm i -S @js-random/number
    

    Usage

    commonjs:

    var randomNumber = require('@js-random/number').default;

    TS/ES6+:

    import randomNumber from '@js-random/number';

    <script> tag:

    <script src="https://unpkg.com/@js-random/number"></script>
    var number = randomNumber(); // from 0 to 100 (inclusive)
    var fromTwoToTen = randomNumber(2, 10); // random number from `2` to `10` (inclusive)

    Global version

    This package also has a global version, which introduces side-effects by exposing the api as Number.random() function.

    Import

    commonjs:

    require('@js-random/number/lib/global');

    ES6+:

    import '@js-random/number/module/global';

    TS:

    import '@js-random/number/module/global';

    <script> tag

    <script src="https://unpkg.com/@js-random/number/unpkg/global"></script>

    Usage

    var number = Number.random(); // from 0 to 100 (inclusive)
    var fromTwoToTen = Number.random(2, 10); // random number from `2` to `10` (inclusive)

    Other packages

    Please, have a look at other packages from @js-random series:

    Install

    npm i @js-random/number

    DownloadsWeekly Downloads

    59

    Version

    0.3.5

    License

    MIT

    Unpacked Size

    10.5 kB

    Total Files

    21

    Last publish

    Collaborators

    • avatar