-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 #5
Conversation
- convert require to import and module.exports to exports - replace var/let with const - use console.assert over assert - add missing test dependency tape pex-geom - remove Math.seedrandom and use new seedrandom global option Closes #2 BREAKING CHANGE: switch to type module
- test with latest geom and math
About the random prng Replied on the issue #4 |
TODO @dmnsgn add some notes about:
|
Did we change seedrandom compared to older versions? Is it their issue? |
It is a seedrandom "standard ARC4 key scheduler cycles short keys" issue, we just never noticed as the test were always using the same 0/1 seeds: Lines 245 to 247 in f199ef8
While I rewrote it to be i/i+1: Lines 339 to 341 in 9293bd2
Test hereUpdate Random.js code to following and run var { describe, it } = require("node:test");
var assert = require("assert");
var rnd = require("../");
describe("Random", function () {
describe("noise2(x, y)", function () {
it("should return the different value for the same x,y", function () {
for (var i = 0; i < 100; i++) {
var x = 100 * Math.random();
var y = 100 * Math.random();
rnd.seed(i);
var r1 = rnd.noise2(x, y);
rnd.seed(i + 1);
var r2 = rnd.noise2(x, y);
assert.notEqual(r1, r2);
}
});
});
}); |
Changes:
TBD:
Closes #2
Closes #4