I want to generate a random int between two values in elm. Something like this:
nb = random(0, 10)
I have read the doc and multiple post. The best answer was from this stackoverflow post
gen = Random.int 0 10
seed0 = Random.initialSeed 123456
Random.generate gen seed0
But the issue is it's always return the same value and it's not even an int it's something like this:
(7,Seed { state = State 645041272 40692, next = <function>, split = <function>, range = <function> })
: ( Int, Random.Seed )
So from the doc, it's better to use the current time for the seed. But how do I get it? Do I have to use signal for this ? is there not an easy way to get a timestamp?
I'm a lot confuse, I need to generate a random int for the seed so I can generate a random int. If not the random int generated is not random. I think I have misunderstood something ...
edit: I have also found this post but I didn't understand everything.