Skip to content

Commit

Permalink
Fixed comments and rand API
Browse files Browse the repository at this point in the history
  • Loading branch information
FugueNation committed Dec 13, 2011
1 parent 46a79b7 commit 20fe878
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/mersenne.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class,
// an almost straight conversion from the original program, this.mt19937ar.c,
// an almost straight conversion from the original program, mt19937ar.c,
// translated by y. okada on July 17, 2006.
// and modified a little at july 20, 2006, but there are not any substantial differences.
// in this program, procedure descriptions and comments of original source code were not removed.
Expand All @@ -8,7 +8,7 @@
// lines commented with // are additional comments in this JavaScript version.
// before using this version, create at least one instance of MersenneTwister19937 class, and initialize the each state, given below in c comments, of all the instances.
/*
A C-program for this.mt19937, with initialization improved 2002/1/26.
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
Before using, initialize the state by using init_genrand(seed)
Expand Down Expand Up @@ -46,7 +46,7 @@
Any feedback is very welcome.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/this.mt/ethis.mt.html
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/

Expand Down Expand Up @@ -263,14 +263,14 @@ exports.MersenneTwister19937 = MersenneTwister19937;
// Export a simplified function to generate random numbers
var gen = new MersenneTwister19937;
gen.init_genrand((new Date).getTime() % 1000000000);
exports.randInt = function(N) {
exports.rand = function(N) {
if (!N)
{
N = 32768;
}
return Math.floor(gen.genrand_real2() * N);
}
exports.rand = function() {
exports.randReal = function() {
return gen.genrand_real2();
}
exports.seed = function(S) {
Expand Down

0 comments on commit 20fe878

Please sign in to comment.