-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# random-org-http | ||
|
||
[Random.org](https://random.org) via [HTTP Interface](https://www.random.org/clients/http/) | ||
|
||
## Requirements | ||
|
||
* Node ≥ 8.9.0 | ||
|
||
## Usage | ||
|
||
### Random Integers | ||
|
||
```javascript | ||
import {integer, Base} from 'random-org-http' | ||
|
||
const result = await integer({ | ||
base: Base.decimal, | ||
col: 3, | ||
min: 1, | ||
max: 32, | ||
num: 9 | ||
}) | ||
|
||
console.log(result) | ||
``` | ||
|
||
This will print an array of 9 random integers within range [1, 32]. | ||
|
||
### Random Ordered Sequence | ||
|
||
```javascript | ||
import {sequence} from 'random-org-http' | ||
|
||
const result = await sequence({ | ||
min: 10, | ||
max: 100 | ||
}) | ||
|
||
console.log(result) | ||
``` | ||
|
||
This will print an array of all integers within range [10, 100] in random order. | ||
|
||
### Random Strings | ||
|
||
```javascript | ||
import {string} from 'random-org-http' | ||
|
||
const result = await string({ | ||
num: 7, | ||
len: 12, | ||
unique: false, | ||
digits: false, | ||
upperalpha: true, | ||
loweralpha: false | ||
}) | ||
|
||
console.log(result) | ||
``` | ||
|
||
This will print an array of 7 random strings consist of 12 uppercase characters. | ||
|
||
## License | ||
|
||
[MIT](https://git.io/vhaEz) © [Hoàng Văn Khải](https://github.com/KSXGitHub) |