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

Overview

random_number

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(); //=> 0.419534816957152

A more complete example using all API:

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

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

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

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

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

for (let index = 1; index < 5; index++) {
  console.log(`Time ${index}: ${rdGenerator()}`);
}

API

randomNumber(options)

Receive options

This is exported as default and as a named export for flexibility.

randomNumberGenerator(options)

Receive options

randomNumberList(length, options)

length

Type: number

The length of the wanted array of random numbers.

Options

A TypeScript type.

min

Type: number || undefined

The minimum value

max

The maximum value

Type: number || undefined

integer

Type: boolean || undefined

Makes the result an integer instead of a decimal

License

This project is licensed under the MIT License.

You might also like...

A Lua plugin, written in TypeScript, to write TypeScript (Lua optional).

typescript.nvim A minimal typescript-language-server integration plugin to set up the language server via nvim-lspconfig and add commands for convenie

Dec 29, 2022

Check the strength of your password simply and quickly, and with optional UI indicators

Check the strength of your password simply and quickly, and with optional UI indicators. Lock Steel is lightweight, has no dependencies and is connected with the UI elements. Just pure CSS and VanillaJS.

Sep 15, 2022

ESLint plugin to disallow the optional-call operator

ESLint Plugin: no-optional-call Overview The no-optional-call ESLint plugin provides a single rule (non-configurable) that disallows any usage of the

Sep 24, 2022

NFT Art Generator made to create random unique art and their metadeta for NFTS.

NFT Art Generator made to create random unique art and their metadeta for NFTS.

Welcome to HashLips πŸ‘„ All the code in these repos was created and explained by HashLips on the main YouTube channel. To find out more please visit: ?

Dec 11, 2022

Password Generator - A fast, simple and powerful open-source utility tool for generating strong, unique and random passwords

A fast, simple and powerful open-source utility tool for generating strong, unique and random passwords. Password Generator is free to use as a secure password generator on any computer, phone, or tablet.

Aug 3, 2022

Competidaily Generator lambda function to retrieve a random theme from our database.

Competidaily Generator backend - GET RANDOM THEME This repo contains the GET requisition used as a lambda function to retrieve a random theme from the

Dec 17, 2022

A list of movies are shown and you can add a comment on them or like them.

Dynasty Entertainment. A list of movies are shown and you can add a comment on them or like them. Built With HTML, CSS & JavaScript. webpack, bootstra

Nov 25, 2022

A simple site to generate useful resources for Gitpodification, including "open in gitpod" buttons and sample configuration scripts

Gitpodify A simple portal to generate "open in Gitpod" links Contributing There is a list of suggested repositories in app/routes/index.tsx. Feel free

Nov 7, 2022

Generate random ethereum wallets & private keys and then check if they match a wallet that contains some kind of balance, so that you can take it. In Node.js

Ethereum-Stealer Generate random ethereum wallets & private keys and then check if they match a wallet that contains some kind of balance, so that you

Dec 24, 2022
Releases(2.0.0)
Owner
Eliaz Bobadilla
A 15 years old, system/backend developer, bookworm, cheese lover, and musician. I like to work with Go and JavaScript.
Eliaz Bobadilla
A minimal seeded random number generator.

gnrng A minimal seeded random number generator that generates numbers between -1 and 1. Adapted from the more full-featured seedrandom (and using xors

Steve Ruiz 11 Nov 23, 2022
This is a Webpack based to-do-list project. With this app, users can add thier daily routine tasks to the list, mark them as complet, edit them or delete them.

To Do List This is a Webpack based to-do-list project. With this app, users can add thier daily routine tasks to the list, mark them as complet, edit

Ali Aqa Atayee 12 Oct 30, 2022
A bot that generate random french proverb images and post them on Twitter.

Proverbot This repository contains the source code of a bot that generate random french proverb images and post them on Twitter. (Inspired by InspiroB

Angel Uriot 14 Dec 11, 2022
This "To-do-list" app is a simple web application that displays a list of task and allows you to add and remove task from that list. it is built with the latest technology namely; JavaScript with webpack Configuration.

To-do-list "To-do-list" is a simple web application that displays a list of task and allows you to add and remove task from that list. Built With HTML

Aniekan udo 10 Nov 21, 2022
Multiplies a number by zero. Useful for when you need to multiply a number by zero

multiply-by-zero Multiplies a number by zero. Useful for when you need to multiply a number by zero Please consider checking out the links of this pro

Dheirya Tyagi 2 Jul 3, 2022
jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask library

jquery-input-mask-phone-number A jQuery Plugin to make masks on input field to US phone format. Quick start 1. Add latest jQuery and jquery-input-mask

Raja Rama Mohan Thavalam 12 Aug 25, 2022
Types generator will help user to create TS types from JSON. Just paste your single object JSON the Types generator will auto-generate the interfaces for you. You can give a name for the root object

Types generator Types generator is a utility tool that will help User to create TS Interfaces from JSON. All you have to do is paste your single objec

Vineeth.TR 16 Dec 6, 2022
An easy-to-use library to make your life easier when working with random numbers or random choices in javascript.

vrandom An easy-to-use library to make your life easier when working with random numbers or random choices in javascript. Table of contents Installati

Valerio Cipolla 1 Aug 16, 2022
Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Seth Yuan 66 Jan 1, 2023
In this project, you can create optional rooms and people can talk in the rooms

CodeTalk In this project, you can create optional rooms and people can talk in the rooms. Login and Registration page Login page welcomes us. If you d

NazlΔ± 3 Mar 12, 2022