Reputation: 3040
Im using https://github.com/Atrox/haikunatorjs/issues/38 to generate random word combos like heroku. I plan to use them as memorable IDs. BUT...
As you can see here https://codesandbox.io/s/8kxj9pq7pl everytime the app restarts the random combos are generated in the same order.
How can i modify the script to get the combinations in random order?
const Haikunator = require("haikunator");
Upvotes: 0
Views: 290
Reputation: 2369
When you're creating the Haikunator
, define the seed as seed: new Date().getTime()
. That way, the seed for the random generator will change every time you load the page.
Upvotes: 3