question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dice, shuffling etc. all require randomness, but having impure reducers (using Math.random(), for example) breaks the ability to view earlier game states (and is an anti-pattern in Redux). We should use a seed in ctx (that’s stripped away before sending it to the client) that is used to predictably generate random numbers.

Plan:

  • API to generate random numbers.
  • API for various die rolls.
  • API to shuffle an array.
  • Allow calling the Random API in flow code (only really supported in moves at the moment).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:31 (30 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolodaviscommented, Feb 10, 2018

Yep, sounds good. I’m happy to make the necessary changes to your PR before merging it in too.

1reaction
Stefan-Hankecommented, Feb 9, 2018

OK. Turns out that test used plain numbers for G. I hope you don’t mind that I changed it to be an object with one key arg.

I’m royally unsure about my changes in the rollup config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Random Data API
Random Data Generator. Generate random fake data and populate your application for easier development and testing. Get Started. It's Free. Random Data API...
Read more >
62 Random APIs (2022) - ProgrammableWeb
Top Random APIs including APIs from .net Daily Fact, I Heart Quotes, Fairluck, Cat, Notable And Quotable Random Quote, Alagad Fortune, Anu Quantum...
Read more >
Random User Generator | Home
Random user generator is a FREE API for generating placeholder user information. Get profile photos, names, and more. It's like Lorem Ipsum, for...
Read more >
9 Random APIs & Free Alternatives List - December, 2022
Browse 9+ Random APIs available on RapidAPI.com. Top Random APIs include Random User, Bestquotes, Dad Jokes and more. Sign up today for free!...
Read more >
Random (Java Platform SE 8 ) - Oracle Help Center
Creates a new random number generator using a single long seed. Method Summary. All Methods Instance Methods Concrete ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found