Skip to content

zhs007/libfortunajs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fortuna Random Algorithm For Node.js

libfortunajs has been certified by iTech's random algorithm.

About libfortuna

libfortuna uses code from the PostgreSQL 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 is a nodejs c++ addon project.

This library can be compiled with node-gyp .

libfortunajs export some functions, which in our game only use randomInt .

Install or Compile libfortunajs

libfortunajs has been publish to npm , all projects base nodejs can be download source code to compile and use.

npm i libfortuna --save

Nodejs version 8.x is recommended.

libfortunajs compile with 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 installation instructions.

Samples

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

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