# best-for-bloom

> Calculate amount of bits and hash functions based on the amount of items and the probability of false positives.

Latest version **1.0.0** (published 2019-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install best-for-bloom
pnpm add best-for-bloom
yarn add best-for-bloom
bun add best-for-bloom
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-12-06 |
| First published | 2019-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Richie Bendall |
| Maintainers | richienb |
| Keywords | bloom, best, calculate, compute, recommend, math |

## Links

- npm: https://www.npmjs.com/package/best-for-bloom
- Repository: https://github.com/Richienb/best-for-bloom
- npm.io page: https://npm.io/package/best-for-bloom

## 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

- 1.0.0 (latest) — 2019-12-06

## README

# Best For Bloom [![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/best-for-bloom/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/best-for-bloom)

Calculate amount of bits and hash functions based on the amount of items and the probability of false positives.

[![NPM Badge](https://nodei.co/npm/best-for-bloom.png)](https://npmjs.com/package/best-for-bloom)

## Install

```sh
npm install best-for-bloom
```

## Usage

```js
const bestForBloom = require("best-for-bloom");

bestForBloom(100000, 1e-6)
//=> { bits: 2875518, hash: 20 }
```

## API

### bestForBloom(items, probability)

#### items

Type: `number`

Number of items in the filter.

#### probability

Type: `number`

Probability of false positives, decimal between 0 and 1. Default is 1e-7 (1 in 1 million).

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