New problem idea and the fuzz about true randomness

Back to General discussions forum

Radovan Markus     2020-02-06 07:49:51
User avatar
Hello Rodion! (and our fellow brethren and sistren reading this )

I would like to propose a new idea that would be connected with randomness and dices. It is true that randomness might be quite controversial and it is also often discussed topic. Are random number generators truly that random as they pretend to be? I played a game called Catan settlers, before I get to how it is linked with our problem let me very briefly explain how is the game played.

The game board is build, each player picks a color pretty much like most of the tabletop games. The board consists of hexagonal tiles, each with certain resource and number from 2 to 12. Every player has the starting location according to his color he picked and the main goal of this game is to build towns, roads and cities. To build something you need one of few (not sure how many 4 or 5 maybe) resources and you have points for having these structures. Player with most points wins. Each turn the current player performs double dice roll and according to number and his position on the board he can draw a card with resource. The game is more complex, if you want to know more, please refer to Wikipedia article.

The idea behind this is, that the position of your structures can be better or worse and that is not that much obvious if you don't think about it a little. Why? If you perform double dice roll there are numbers occurring more often than others. Well I was curious (and also forgot that we had this in high school math) so I made a program for calculating the probability of each number occurring and when I saw the results I suddenly remembered that this could have also mathematical approach which I forgot we had. The results were that most common number is 7 (in 1 out of 6 cases) and then numbers close to 7 with the smallest chance of occurring for numbers 2 and 12. It is due to the fact that number 7 has most of possible combinations (6 if I am not mistaken) when rolling 2 dices. ( 1+6, 2+5, 3+4, 4+3, 5+2, 6+1) While numbers like 2 or 12 have only 1 combination. So it appears that players with their villages that have numbers closer to 7 are more beneficial than others. (Maybe I could mention that number 7 is reserved for bandits so numbers 6 and 8 are the best in game positions).

So we are getting to problem statement with the "random" number generator. The task could look something like this:

You are given number of dices and you are to calculate the most and least common numbers when performing this dice roll. If you wanted to make task more difficult you could also include the % probability rounded to 2 decimal places and provide some crazy big input or adding more rules.

If may I be curious, how is randomness of other tasks generated? I believe that you may not use randomness at all but pseudo random numbers so the values can be what you need to. I have also noticed that there are no tasks for which I had to include library random (java.util.Random) and I believe that this is because you need to check certain user input which could be difficult for random values. For instance I can think of task 72 where is this pseudo random used.

So my question is: "Do you use random while generating input values for tasks?" and also how much do you trust these RNGs ? I have heard our teacher telling us that computers use time as random number generators,

so I was quite surprised when I heard for the very first time about this random problem. Speaking of random, my first doubts appeared when I have heard of Monty hall problem when I was really skeptic that much I had to run simulation first, and the results proved to be true. Further research explained why is it so. This video (however in Czech, sorry for that) explains that if you were to pick 1 of 100 doors and the doors were reduced to 3, you were now more likely to guess the correct door than you were when you picked your first door.

The idea with multiple dices seems nice to me and I would be glad if you added it. If you do so, I hope you stick as much as possible to my suggestions how should problem statement look like, without googling more stuff :D .

Thanks for reading all the way down here!

Sincerely, Radovan.

Rodion (admin)     2020-02-06 16:12:07
User avatar

Radovan, Hi!

I initially thought the idea is about the game itself :)

As for dice... Have you seen the problem about dungeons-n-dragons dice?

I suspect it is the same you mean, but slightly from the other end - to guess what dice are used judging by statistics of throws.

In straight version to calculate the most and least common numbers when performing this dice roll it is bit too straightforward... Or at least I don't know how to make it less or more complicated...

I believe that you may not use randomness at all but pseudo random numbers

I'm not sure what you mean by pseudo-random. In general sense all random generators in general computers are "pseudo-random". You initialize them once (say, with current timestamp) and then generates numbers in seemingly random manner.

What we call "truly random" is the device which generates random bits based on nuclear fission or electro-magnetic noise in surrounding. Generally our computers don't have such special modules.

So all your java.util.Random or java.security.SecureRandom, or rand in PHP (often used by data generation code at this site), or even /dev/random - they are pseudo-random. You can with some efforts predict next value after you've seen several previous (though with SecureRandom it is much harder).

It's just not possible to generate more than 1 random number for task based on time. Because all data are generated at almost the same millisecond. And anyway time is changing monotonously so it wouldn't be true random if several values are generated based on nanoseconds...

I have also noticed that there are no tasks for which I had to include library random (java.util.Random)

It's just hard to invent task which will need this. Because usually your code takes input data and generates some response - there is no clear opportunity to plug in randomly generated numbers which are not related to input data... Though some problems can (and even need) really be solved by some random process. Even like this
Random Search Optimization
or this
Page Rank

Radovan Markus     2020-02-06 19:06:18
User avatar

I suspect it is the same you mean, but slightly from the other end - to guess what dice are used judging by statistics of throws. Seems like you are completely right! I didn't solve this problem yet so I couldn't know. Maybe I should check for similar tasks before posting here. I am somewhat smarter now. I didn't know or think about ... time is changing monotonously so it wouldn't be true random if several values are generated based on nanoseconds

You can with some efforts predict next value after you've seen several previous (though with SecureRandom it is much harder). This sounds like more difficult task to accomplish. Maybe this could be used for new problem idea? If you're not currently overwhelmed with work I think the new task could be inspired at least from what you just said, but it is easy for me to say.

Anyway, thanks for answer! (:

Please login and solve 5 problems to be able to post at forum