I’m using JSON Generator https://next.json-generator.com to seed my MongoDB database. I’m finding trouble to generate a random set (from one to six) of colors out of the predefined group. I’ve succeeded to generate all of the other property values but color. I need for the availableColors key to generate a random variable number of colors out of a predefined set
Tag: seeding
Seeding the random number generator in Javascript
Is it possible to seed the random number generator (Math.random) in JavaScript? Answer No, it is not possible to seed Math.random(), but it’s fairly easy to write your own generator, or better yet, use an existing one. Check out: this related question. Also, see David Bau’s blog for more information on seeding.