2

I want to implement a very simple random number generator in Google Sheets to play DnD with my friends. There is a built in, but the problem is that it does not take a seed, and every time we roll it each person sees a different result.

I want an example of a simple, non-recursive, with non-overflowing intermediate results function that I can easily implement using Google Sheets so that I can feed it an integer input and return a random output in the range of 1 to 6.

It does not have to be foolproof, just random enough to withstand casual scrutiny and be equally likely to generate all possible outcomes for the first 200 rolls or so

Jsevillamol
  • 4,668
  • Wikipedia has a nice list of things you could try: https://en.wikipedia.org/wiki/List_of_random_number_generators#Pseudorandom_number_generators_(PRNGs) – Matti P. Jul 20 '20 at 09:32
  • Maybe you could take, for example, this and modify it to your needs: https://en.wikipedia.org/wiki/Lehmer_random_number_generator – Matti P. Jul 20 '20 at 09:38
  • 3
    It took me about 5 minutes to set up in Google Sheets the simple-but-well-tested portable seeded generator described here. This is the Lewis-Goodman-Miller (1969) “minimal standard generator". – r.e.s. Jul 26 '20 at 23:01
  • @r.e.s. that is exactly what I was looking for - if you want to turn your comment into an answer including the code I'll be happy to accept it – Jsevillamol Jul 27 '20 at 18:24
  • Thanks, but I'm reluctant to do so, as I expect someone will soon vote to close your question due to it being off-topic for MathSE. It's a nice generator though, and to implement it only requires cut-and-pasting the two equations (4) and (5) from that paper (with the given constants and addresses substituted). – r.e.s. Jul 27 '20 at 23:34

0 Answers0