An exploration of randomness.
  • 266 posts
  • Page 15 of 18
dough_boy wrote:
Ultimately people tend to remember the bad turns and not the good turns. I have had 50/50 turns, some where I lose everytime, others where I win everytime...including when it was 2v1, etc.
doncarp14 wrote:
dough boy i just had the exact thing happen to me; attacking alaska from russia 9 to 1....lost 7 consecutive 3 on 1 rolls...
aeronautic wrote:
They are random, but that means anything is possible at any time and remember that the defence only have to match your highest dice to win, so even if the defence rolls a 2, if you roll 2, 2, 1 then the defence wins again.

Anyway, I started a thread on suggestions to improve the situation where the defence has much less chance of winning when greatly outnumbered.
Here
Hyd yn oed er fy mod Cymraeg , dim ond yn siarad Saesneg, felly yr wyf yn gobeithio y bydd y cyfieithu yn gywir.
aeronautic wrote:
Oh yes, I forgot to mention that the dice were designed around slackbatter. :P

But seriously, I started a thread on suggestions to improve the situation where the defence has much less chance of winning when greatly outnumbered.
Here
Hyd yn oed er fy mod Cymraeg , dim ond yn siarad Saesneg, felly yr wyf yn gobeithio y bydd y cyfieithu yn gywir.
doncarp14 wrote:
just attacked with 11 on 1.....did not take territory....8 consecutive losses on 3 to 1 rolls...then a 2 on 1 loss....this happens far too frequently, something off with the defense dice...
GriffinUcos wrote:
aeronautic
Oh yes, I forgot to mention that the dice were designed around slackbatter. :P

I believe you. Not sure how everyone else feels but I gave up moaning (too much) about bad dice. It happens to everyone, and it's how they handle the bad rolls that puts people like slackbatter, at the top.
"Gentlemen, when the enemy is committed to a mistake we must not interrupt him too soon."
doncarp14 wrote:
just had a turn where i lost 14, killed 0.....0 to 8 in one battle, 0 to 6 in another....this was right after the player before me killed 2 and lost 8....attacking is futile and the dice algorithm here ruins games
The_Bishop wrote:
@doncarp14
You only played 63 games, your statistical sample is really too small.
The fact that you have been unlucky doesn't mean that "this dices are broken" (cit.) !
«God doesn't play dice with the World» ~ Albert Einstein
Cireon wrote:
I've spent some time collecting all the information from this thread and putting it on a single page for easy reference: https://dominating12.com/its-never-the-dice
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
dough_boy wrote:
Cireon
Since there are 256 unique values in a byte, but 256 is not divisible by 6, if the number is 252 or higher, we generate a new byte instead to ensure all numbers have an equal chance of occurring.
To transform the byte into the number rolled by the dice, we do an operation called modulus. This is the same as dividing a number by another, and taking the remainder. So if we wanted to take a generated 51 and turn it into a roll for a six-sided dice, we would take the remainder, which is 3, since 51 = 6 * 8 + 3.

Why not use random_int

1, it seems like regenerating if the value is 252+ is a greater chance for a dice to be higher the second time around.
2, because while the % is the same, 1/6 vs 42/251* you now have a 7 times higher likelihood to roll any given number.

*Hopefully, it is just a typo but this states 252 or higher when it should be 253 or higher. If the code is truly looking at anything greater than 251 (252-256) then this means that rolling a 1 has a .4% LESS chance of being rolled. Since the tie goes to the defense this is probably a significant difference.

Would it be possible to do a simulation using random_int vs the one you currently are doing?
Cireon wrote:
Why not use random_int?
Because when we wrote this code, this function wasn't available to us. The only random functions available were not as random.

Hopefully, it is just a typo but this states 252 or higher when it should be 253 or higher.
It is not a typo, since the generated numbers are zero-based.

Would it be possible to do a simulation using random_int vs the one you currently are doing?
We'd have to implement it in the first place, and I don't see any reason why it would make a difference.
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
dough_boy wrote:
Sorry, forgot about the 0 based.

I went ahead and built a 10k turn simulator. It compares the current way (CSPRNG), random_int, and mt_rand. The image below shows the difference from the expected for all three after 40k turns.

[image]

Surprisingly mt_rand is more accurate (the closer to 0 the better).
elysium5 wrote:
If you read the very beginning of this thread, I questioned the randomness of the dice myself. Upon learning that we used mt_rand, I did a lot of research on it and could not find a better PRNG compared to a TRNG which you can not even write a code for, I believe. I referenced a site a long time ago about it. I believe this was the site: Random.Org. There are a lot of questions that can be answered if you want further information about randomness and how it is generated using mt_rand. While I believe the application of the newer random_int as dough suggested is used for other applications, as he just demonstrated for our purposes, the mt_rand is still superior than anything else for our purposes.

Obviously, this is a site that offers both free and paid services but there is valuable information to be had there if you really want to do the research without doing too much work to find it on your own.

Here is a little snippet for anyone who is truly interested on the difference between a PRNG and a TNRG from that site and why mt_rand is a PRNG about as close as you can get to a TNRG at the time I posted it:

Spoiler (click to show)
"Bad Deadpool... Good Deadpool!"