@audio/synth-noise 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/colors.js +4 -1
- package/package.json +1 -1
package/colors.js
CHANGED
|
@@ -9,10 +9,13 @@
|
|
|
9
9
|
import pinkNoise from './pink-noise.js'
|
|
10
10
|
export { default as pinkNoise } from './pink-noise.js'
|
|
11
11
|
|
|
12
|
+
// x ← (1103515245·x + 12345) mod 2³¹ (glibc's TYPE_0 random()), period 2³¹. Math.imul keeps the
|
|
13
|
+
// product exact mod 2³²: as a double it passes 2⁵³, its low bits round, and each of the seeds
|
|
14
|
+
// 1..65536 then falls into a cycle of 10,466 steps or fewer
|
|
12
15
|
function lcg (seed) {
|
|
13
16
|
let s = seed >>> 0 || 1
|
|
14
17
|
return () => {
|
|
15
|
-
s = (s
|
|
18
|
+
s = (Math.imul(s, 1103515245) + 12345) & 0x7fffffff
|
|
16
19
|
return s / 0x3fffffff - 1
|
|
17
20
|
}
|
|
18
21
|
}
|