random_number

Includes REST API, CLI Tool and Package

Generate a random number, a list of them, or a generator, with optional configuration!

Usage

import { randomNumber } from "https://deno.land/x/random_number/mod.ts";

randomNumber(); //=> 21
randomNumber({ max: 3 }); //=> 2
randomNumber({ min: 3, max: 6 }); //=> 4
randomNumber({ integer: false }); //=> 0.419534816957152

All API 👇

import {
  randomNumber,
  randomNumberGenerator,
  randomNumberList,
} from "https://deno.land/x/random_number/mod.ts";

const randomInteger = randomNumber({ max: 5 });
console.log(`Random integer: ${randomInteger}`);

const randomDecimal = randomNumber({ integer: false });
console.log(`Random decimal: ${randomDecimal}`);

const randomNumbers = randomNumberList(randomInteger);
console.log(`List Random numbers: ${randomNumbers.join(", ")}.`);

const rdGenerator = randomNumberGenerator({ max: 50 });

for (let index = 1; index < 5; index++) {
  console.log(`Time <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mi>i</mi><mi>n</mi><mi>d</mi><mi>e</mi><mi>x</mi></mrow><mo>:</mo></mrow><annotation encoding="application/x-tex">{index}: </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord"><span class="mord mathnormal">in</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mord mathnormal">x</span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span></span></span></span>{rdGenerator()}`);
}

Pull Request Expanding the API are welcome

Docs

Check the Auto Generated Docs

License

This project is licensed under the MIT License.