Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abdullah0332/randomvalue-js
https://github.com/abdullah0332/randomvalue-js
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/abdullah0332/randomvalue-js
- Owner: Abdullah0332
- Created: 2021-08-21T06:22:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-21T06:40:46.000Z (about 3 years ago)
- Last Synced: 2024-10-30T03:40:03.343Z (15 days ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# randomvalue-js
> Random Number Generator.
# Install
`npm install randomvalue-js`
# Usage
```javascript
var random = require("randomvalue-js");random(); // sample output → 0.6916960302530633
```## Default Options
the exported function takes an **params**
- `min` : smallest possible value to return. defaults to 0.
- `max` : largest possible value to return. defaults to 1.```js
var random = require("randomvalue-js");// Default Random
random();//Integer
random.integer(); // example output -> 0, default min = 0 and max = 1
//or
random.integer(min, max);
random.integer(2, 10);//Float
random.float(); // example output -> 0.6916960302530633, default min = 0 and max = 1
//or
random.float(min, max);
random.float(2, 10);//Boolean
random.bool(); // example output -> true
```#### Table of Contents
- [Random](#random)
- [integer](#integer)
- [float](#float)
- [bool](#bool)#### [random](https://github.com/transitive-bullshit/random/blob/e11a840a1cfe0f5bd9c43640f9645a0b28f61406/src/random.js#L47-L49)
var random = require("random-np");
random();Type: `function ()`
---
#### [integer](https://github.com/transitive-bullshit/random/blob/e11a840a1cfe0f5bd9c43640f9645a0b28f61406/src/random.js#L152-L154)
Samples a random integer, optionally specifying min and max values.
Convence wrapper around `random.integer()`
Type: `function (min, max): number`
- `min` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** (integer, inclusive) (optional, default `0`)
- `max` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** (integer, inclusive) (optional, default `1`)---
#### [float](https://github.com/transitive-bullshit/random/blob/e11a840a1cfe0f5bd9c43640f9645a0b28f61406/src/random.js#L138-L140)
Samples a random floating point number, optionally specifying min and max values.
Convence wrapper around `random.float()`
Type: `function (min, max): number`
- `min` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** (float, inclusive) (optional, default `0`)
- `max` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** (float, exclusive) (optional, default `1`)---
#### [bool](https://github.com/transitive-bullshit/random/blob/e11a840a1cfe0f5bd9c43640f9645a0b28f61406/src/random.js#L181-L183)
Samples a random boolean value.
Convence wrapper around `random.bool()`
Type: `function (): boolean`
---