# java-random

> A partial implementation of java.util.Random for JS

Latest version **0.4.0** (published 2018-11-15) · ISC license · 0 weekly downloads

## Install

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

## 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.4.0 |
| Published | 2018-11-15 |
| First published | 2018-11-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Ray Bellis |
| Maintainers | raybellis |
| Keywords | java, random, prng |

## Links

- npm: https://www.npmjs.com/package/java-random
- Repository: https://github.com/raybellis/java-random
- Homepage: https://github.com/raybellis/java-random#readme
- Issues: https://github.com/raybellis/java-random/issues
- npm.io page: https://npm.io/package/java-random

## Recent versions

- 0.4.0 (latest) — 2018-11-15
- 0.3.0 — 2018-11-14
- 0.2.2 — 2018-11-14
- 0.2.1 — 2018-11-09
- 0.1.1 — 2018-11-08
- 0.1.0 — 2018-11-08

## README

JavaRandom
==========

An almost complete implementation in JS of the `java.util.Random` class
from J2SE, designed to so far as possible produce the same output
sequences as the Java original when supplied with the same seed.

usage:

    let Random = require('java-random');
    let rng = new Random(1);
    let val = rng.nextInt();

methods implemented are:

    setSeed(seed)
    nextInt()
    nextInt(bound)
    nextBoolean()
    nextFloat()
    nextDouble()
    nextGaussian()

The Java functions that return a `Stream` are replaced with JS
generator functions:

    ints()
    ints(streamSize)

    doubles()
    doubles(streamSize)

The Java functions that generate `long` values are not available
except on JS platforms that are able to return a 64-bit `BigInt`
instead of a `Number`:

    nextLong()
    longs()
    longs(streamSize)

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