Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
mankal111 committed Oct 7, 2018
1 parent 28f278e commit dde2638
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JXRand [![Build Status](https://travis-ci.org/mankal111/JXRand.svg?branch=master)](https://travis-ci.org/mankal111/JXRand) [![Coverage Status](https://coveralls.io/repos/github/mankal111/JXRand/badge.svg?branch=master)](https://coveralls.io/github/mankal111/JXRand?branch=master)
# JXRand [![Build Status](https://travis-ci.org/mankal111/JXRand.svg?branch=master)](https://travis-ci.org/mankal111/JXRand) [![Coverage Status](https://coveralls.io/repos/github/mankal111/JXRand/badge.svg?branch=master)](https://coveralls.io/github/mankal111/JXRand?branch=master) [![npm version](https://badge.fury.io/js/jxrand.svg)](https://badge.fury.io/js/jxrand)

Javascript eXtended Random number generator

Expand All @@ -10,11 +10,33 @@ Javascript eXtended Random number generator
## Usage
```js
var JXRand = require('JXRand');
```

To get a random integer between 10 and 20:

```js
var randomInt = JXRand.getNumber({min: 10, max: 20, type: 'integer'});
```

var randomInt = JXRand.getInteger(0, 10); // A random integer in the interval [0, 10]
var randomFloat = JXRand.getFloat(0, 2); // A random float in the interval [0, 2]
The `type` property is optional with a default value of `float`.
For now the supported types are `integer` and `float`.

To get a random interval, with integer endpoints between 0 and 100 and length between 10 and 50:

```js
var randomInterval = JXRand.getInterval({
min: 0,
max: 100,
minLength: 10,
maxLength: 50,
type: 'integer'
});
```

A possible value of `randomInterval` is `[43, 75]`.

The `minLength`, `maxLength` and `type` properties are optional.

## Tests
```
npm test
Expand Down

0 comments on commit dde2638

Please sign in to comment.