MCPcopy Create free account
hub / github.com/caike/jQuery-Simple-Timer / unitSamplerGenerator

Function unitSamplerGenerator

tests/qunit-2.9.2.js:2696–2713  ·  view source on GitHub ↗

* Creates a seeded "sample" generator which is used for randomizing tests.

(seed)

Source from the content-addressed store, hash-verified

2694 * Creates a seeded "sample" generator which is used for randomizing tests.
2695 */
2696 function unitSamplerGenerator(seed) {
2697
2698 // 32-bit xorshift, requires only a nonzero seed
2699 // http://excamera.com/sphinx/article-xorshift.html
2700 var sample = parseInt(generateHash(seed), 16) || -1;
2701 return function () {
2702 sample ^= sample << 13;
2703 sample ^= sample >>> 17;
2704 sample ^= sample << 5;
2705
2706 // ECMAScript has no unsigned number type
2707 if (sample < 0) {
2708 sample += 0x100000000;
2709 }
2710
2711 return sample / 0x100000000;
2712 };
2713 }
2714
2715 /**
2716 * This function is called when the ProcessingQueue is done processing all

Callers 1

addToTestQueueFunction · 0.85

Calls 1

generateHashFunction · 0.85

Tested by

no test coverage detected