Help with a wordle-like game

Hi, I am making wordle but with 5 digit numbers. I want to make a daily mode, and I've decided to do this by somehow turning the current date into a five digit number. How would I do this? I'm okay if it repeats every >=5 years. I've tried different pseudo-random number generators but none have worked.

What you need is a seeded random number generator

Similar seeds (30926, 30927, 30928) give outputs that are too similar. I guess I need some sort of hash function like MD5, but most of them seem too complicated to implement.

the simplest i can think of is just square it, cube it, etc but it wouldn't work well for low numbers

I think that's not a coincidence. You want your program to have non-simple behavior, so it's going to have a non-simple algorithm.

The good news is that part of the complexity of MD5 is to guard against bad guys being able to create a different text that has the same MD5 hash. You don't care about that. So you can probably use a different hash function, e.g., for each digit in the seed, add its character code to the hash, then rotate the hash left four bits.

You could Do like old games used to do for rng

Raise the date to a power of let’s say 17, keep the middle 5 didgets, then take that number and raise it to a power of 17, etc, you’ll be given a 5 didget number that is seemingly random but actually based on a seed

If you for some reason don’t want a seed just do “pick random (10000) to (99999)”

Another approach is to use the sha512 hash block and join the first 5 numbers together (it’s might be possible for it to not have 5 numbers but that’s unlikely)
This is much smaller and doesn’t risk reaching infinity (doing “item 1 to 5” is faster than “keep index <= 5” as I originally had)

Rng2s script pic

Of course you're still indirectly using a seed; PICK RANDOM doesn't make truly random numbers.

How does it work then?
If you use the current Unix time stamp as the seed then that’s always different meaning yeah it is “random” If you get a random input you get a random output
Random in the sense you can’t get the same seed 2 times

there is no way to make a computer generate randomness.
you can still get purely random numbers from a website that uses real-life randomness to get a number

that's not random, we can predict how long 1 second is, 5 seconds, etc.

but that's not the definition of random

Kind of not but also yes?

True random numbers can't be generated by digital systems. By definition, a digital system is one that eliminates the small irregularities that occur in electronic circuits by recognizing only two values. So, let's say the voltage on a particular wire has to be somewhere between 0 and 5 volts. You build digital circuits in a way that makes anything between 0 and 0.5 volts count as zero, anything between 4.5 and 5 volts count as one, and anything between 0.5 and 4.5 is flagged as a hardware error.

Since digital hardware can't generate randomness, neither can software. True randomness has to come from some analog (non-digital) sensor. This is almost true. gives the example of a web server counting how many HTTP(S) requests come in each second as the source of randomness, and that seemingly doesn't use special analog hardware. But it really does, namely, it uses human beings, who click on web links more or less randomly. If it turned out that most of the requests came from other computer software rather than from human beings, the result wouldn't be random. I was taught to measure the voltage drop across a diode, which is typically around 0.7 volts, but that's an approximate number; you might measure 0.70001 volts one time, and then 0.699994 the next time. (The voltage drop is a quantum phenomenon, so this variation is quantum randomness.)

If you have a number that’s always different and never the same. Running that through an algorithm would produce random numbers

No, not really. If you run the same seed through the same algorithm again, you'll get the same sequence of numbers out.

i said is one of them

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.