File: altprng.html

package info (click to toggle)
node-seedrandom 2.4.3%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 488 kB
  • sloc: javascript: 5,392; sh: 3; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<html>
<head>
<link rel="stylesheet" href="lib/qunit.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="../lib/xor4096.min.js"></script>
<script src="lib/qunit.js"></script>
<script>
QUnit.module("Alternative PRNG Test");

QUnit.test("Verify that we can use xor4096", function(assert) {
// Use xor4096 for Richard Brent's xorgens-4096 algorithm.
var xorgen = new xor4096('hello.');

// By default provides 32 bits of randomness in a float.
assert.equal(xorgen(), 0.9798525865189731);

// Use "double" to get 56 bits of randomness.
assert.equal(xorgen.double(), 0.03583478477375346);

// Use "int32" to get a 32 bit (signed) integer.
assert.equal(xorgen.int32(), 1341429986);

});
</script>
</html>