# choose-randomly-by-ratio

> Choose randomly a value by ratio

Latest version **1.0.2** (published 2015-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install choose-randomly-by-ratio
pnpm add choose-randomly-by-ratio
yarn add choose-randomly-by-ratio
bun add choose-randomly-by-ratio
```

## 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.2 |
| Published | 2015-03-10 |
| First published | 2015-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kjirou |
| Maintainers | kjirou |
| Keywords | random, ratio |

## Links

- npm: https://www.npmjs.com/package/choose-randomly-by-ratio
- Repository: https://github.com/kjirou/choose-randomly-by-ratio
- Issues: https://github.com/kjirou/choose-randomly-by-ratio/issues
- npm.io page: https://npm.io/package/choose-randomly-by-ratio

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-03-10
- 1.0.1 — 2015-03-10

## README

# choose-randomly-by-ratio

[![npm version](https://badge.fury.io/js/choose-randomly-by-ratio.svg)](http://badge.fury.io/js/choose-randomly-by-ratio)
[![Build Status](https://travis-ci.org/kjirou/choose-randomly-by-ratio.svg?branch=master)](https://travis-ci.org/kjirou/choose-randomly-by-ratio)

Choose randomly a value by ratio from collection


## Usage

```
var chooseRandomlyByRatio = require('choose-randomly-by-ratio');

// This value will be 'x'(1.0/4.5) or 'y'(1.5/4.5) or 'z'(2.0/4.5)
var value = chooseRandomlyByRatio([['x', 1], ['y', 1.5], ['z', 2]]);

// It's possible to write like this
var value = chooseRandomlyByRatio({ x: 1, y: 1.5, z: 2 });
```


## Installation

```
npm install choose-randomly-by-ratio
```

Or, you can use in browser through the [browserify](https://github.com/substack/node-browserify).

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