# random-float

> Generate a random float

Latest version **3.0.0** (published 2021-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-float
pnpm add random-float
yarn add random-float
bun add random-float
```

## Health

**Score 28/100 (F)** — status: abandoned.

Positive: has types package; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-04-18 |
| First published | 2015-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/random-float) |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 37 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | random, randomize, float, floating, point, real, number, max, min, math, generate, generator |

## Links

- npm: https://www.npmjs.com/package/random-float
- Repository: https://github.com/sindresorhus/random-float
- Homepage: https://github.com/sindresorhus/random-float#readme
- Issues: https://github.com/sindresorhus/random-float/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/random-float

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-04-18
- 2.0.0 — 2019-04-11
- 1.0.0 — 2015-06-26

## README

# random-float

> Generate a random [float](https://en.wikipedia.org/wiki/Floating_point)

## Install

```
$ npm install random-float
```

## Usage

```js
import randomFloat from 'random-float';

randomFloat(5);
//=> 4.401887938147411

randomFloat(10, 100);
//=> 72.34217455144972
```

## API

### randomFloat(maximum?)

Returns an float from `0` to `maximum`.

### randomFloat(minimum, maximum)

Returns an float from `minimum` to `maximum`.

#### minimum

Type: `number`\
Default: `0`

Minimum float to return.

#### maximum

Type: `number`\
Default: `1`

Maximum float to return.

## Related

- [random-int](https://github.com/sindresorhus/random-int) - Generate a random integer
- [random-item](https://github.com/sindresorhus/random-item) - Get a random item from an array
- [random-boolean](https://github.com/arthurvr/random-boolean) - Get a random boolean
- [random-obj-key](https://github.com/sindresorhus/random-obj-key) - Get a random key from an object
- [random-obj-prop](https://github.com/sindresorhus/random-obj-prop) - Get a random property from an object
- [unique-random](https://github.com/sindresorhus/unique-random) - Generate random numbers that are consecutively unique
- [unique-random-array](https://github.com/sindresorhus/unique-random-array) - Get consecutively unique elements from an array
- [crypto-random-string](https://github.com/sindresorhus/crypto-random-string) - Generate a cryptographically strong random string

---
_Source: https://npm.io/package/random-float · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
