davidbau / seedrandom

seeded random number generator for Javascript
2.04k stars 160 forks source link

cannot get it working in angular #66

Closed kissenger closed 4 years ago

kissenger commented 4 years ago

I have the current question open in SO, do you have any ideas how to fix? https://stackoverflow.com/questions/58192960/how-to-fix-property-seedrandom-does-not-exist-on-type-math?noredirect=1#comment102795124_58192960

davidbau commented 4 years ago

When inside a node app, Math.random is not available; instead you want

var seedrandom = require('seedrandom');
var rng = seedrandom(1);
console.log(rng());

Looks like the SO thread has answered the question; here is the fixed example from the thread:

https://stackblitz.com/edit/angular-thvcfa