Comparing version 1.0.7 to 1.0.8
@@ -1,3 +0,7 @@ | ||
# 1.0.7 (2015-01-13) | ||
# 1.0.8 (2015-10-13) | ||
- add `getUseCount()` to the `mt19937` engine, which returns how many requests or discards have occurred. | ||
# 1.0.7 (2015-10-13) | ||
- the current time is now used in `Random.generateEntropyArray` | ||
@@ -4,0 +8,0 @@ |
@@ -114,2 +114,3 @@ /*jshint eqnull:true*/ | ||
var index = 0; | ||
var uses = 0; | ||
@@ -124,5 +125,10 @@ function next() { | ||
index = (index + 1) | 0; | ||
uses += 1; | ||
return temper(value) | 0; | ||
} | ||
next.getUseCount = function() { | ||
return uses; | ||
}; | ||
next.discard = function (count) { | ||
uses += count; | ||
if ((index | 0) >= 624) { | ||
@@ -148,2 +154,3 @@ refreshData(data); | ||
index = 624; | ||
uses = 0; | ||
return next; | ||
@@ -150,0 +157,0 @@ }; |
{ | ||
"name": "random-js", | ||
"description": "A mathematically correct random number generator library for JavaScript.", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Cameron Kenneth Knight", |
@@ -68,3 +68,6 @@ # Random.js | ||
* `mt.discard(count)`: Discard `count` random values. More efficient than running `mt()` repeatedly. | ||
* `mt.getUseCount()`: Return the number of times the engine has been used plus the number of discarded values. | ||
One can seed a Mersenne Twister with the same value (`mt.seed(value)`) or values (`mt.seedWithArray(array)`) and discard the number of uses (`mt.getUseCount()`) to achieve the exact same state. | ||
### Distributions | ||
@@ -71,0 +74,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177610
2645
263