Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhs007/libfortunajs
libfortuna for nodejs
https://github.com/zhs007/libfortunajs
Last synced: 8 days ago
JSON representation
libfortuna for nodejs
- Host: GitHub
- URL: https://github.com/zhs007/libfortunajs
- Owner: zhs007
- License: apache-2.0
- Created: 2017-10-20T10:17:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T05:35:50.000Z (over 4 years ago)
- Last Synced: 2024-11-03T22:32:16.561Z (13 days ago)
- Language: C
- Size: 77.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fortuna Random Algorithm For Node.js
libfortunajs has been certified by iTech's random algorithm.
### About libfortuna
libfortuna uses code from the [PostgreSQL](http://www.postgres.org/) database project.
The original source location (in the postgres source tree) is contrib/pgcrypto. Also, parts of src/include/postgres.h and src/include/c.h.
### About libfortunajs
[libfortunajs](https://github.com/zhs007/libfortunajs) is a nodejs c++ addon project.
This library can be compiled with [node-gyp](https://github.com/nodejs/node-gyp) .
[libfortunajs](https://github.com/zhs007/libfortunajs) export some functions, which in our game only use ```randomInt``` .
### Install or Compile libfortunajs
[libfortunajs](https://github.com/zhs007/libfortunajs) has been publish to [npm](https://www.npmjs.com/) , all projects base nodejs can be download source code to compile and use.
```
npm i libfortuna --save
```Nodejs version 8.x is recommended.
[libfortunajs](https://github.com/zhs007/libfortunajs) compile with [node-gyp](https://github.com/nodejs/node-gyp) .
except nodejs, you need to python 2.x, gcc 4.9 (on linux), and on mac osx also need xcode, on windows recommended to [node-gyp](https://github.com/nodejs/node-gyp) installation instructions.
### Samples
``` js
const libfortuna = require('libfortuna');function randomInt(max) {
return libfortuna.randomInt(max);
}exports.randomInt = randomInt;
```When the actual game wheel is random, we call it this way
``` js
for (let ii = 0; ii < this.axisnums; ++ii) {
lstLastSymbol[ii] = base.randomInt(lstSymbol[ii].length);
}
```### Update log
- 1.2.15
- fix scaling of rng bug
- 1.2.13
- fix scaling of rng bug
- 1.2.12
- fix scaling of rng bug
- 1.2
- add randomBuf
- 1.1
- add addEntropy
- 1.0
- add random/randomInt