Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed comments and rand API

  • Loading branch information...
commit 20fe87864d0a19ecb959bd4b4349a5a1f8db2613 1 parent 46a79b7
@FugueNation authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/mersenne.js
View
10 lib/mersenne.js
@@ -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.
@@ -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)
@@ -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)
*/
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.