# random-ip

> generate random ip(v4 or v6) addresses

Latest version **0.0.1** (published 2014-01-29) · WTFPL license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2014-01-29 |
| First published | 2014-01-28 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jesse Tane |
| Maintainers | jessetane |

## Links

- npm: https://www.npmjs.com/package/random-ip
- npm.io page: https://npm.io/package/random-ip

## Dependencies (1)

- [ip](https://npm.io/package/ip.md) 0.2.0

## Recent versions

- 0.0.1 (latest) — 2014-01-29
- 0.0.0 — 2014-01-28

## README

# random-ip
generate random ip(v4 or v6) addresses

## why
just playing around with ipv6 and wanted to be able to generate addresses in arbitrary ranges

## how
* depends on @indutny's [node-ip](https://github.com/indutny/node-ip) to parse ip addresses
* uses `Math.random()` to randomly twiddle bits within in the CIDR range you specify

## example
```javascript
var randomip = require('random-ip');

// ipv6
randomip('::', 64)                    // 0:0:0:0:f46c:cde1:a409:d38f
randomip('::', 64, 80)                // 0:0:0:0:9eba:0:0:0
randomip('2001:470:e01::', 48, 64)    // 2001:470:e01:da2f:0:0:0:0

// ipv4
randomip('0.0.0.0', 24)               // 0.0.0.136
randomip('0.0.0.0', 16, 24)           // 0.0.68.0
randomip('192.168.2.0', 24)           // 192.168.2.240
```

## test
`node test`

## npm
`npm install random-ip`

## license
WTFPL

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