What is window.generativeMusic.rng() ?
HI Alex,
I'm exploring the code trying to learn how you made some of these and I'm running into an issue. You have this window.generativeMusic.rng() in use all over the place but I can not find where it is defined. Is it some sort of random seed?
Thanks.
Hi again Tate!
The implementation is a little hacky but it's just a random number generator that defaults to Math.random.
https://github.com/generative-music/pieces-alex-bainter/blob/1186f13dc24a42e5485cc39ede313328f64b4b61/packages/utilities/src/wrap-activate.js#L8-L9
I wanted to add a reward for people who supported Generative.fm where I'd use their name to seed the random number generator, but I'd already written so much code where I just used the global Math.random(). So I just replaced those with window.generativeMusic.rng(), and then I could override it with a another (seedable) rng. For example, here's where I do that in Generative.fm Play: https://github.com/generative-fm/play/blob/11ae5750c0c1aac2ba7b2be5626ebca8c687d434/src/app/redux-app.jsx#L32-L35
I'll be sure to note this in the readme