Forum
What do you use for random numbers?
notgonnatellyou2 wrote
at 9:47 PM, Tuesday January 9, 2007 EST
Please don't say rand(). The number generator for this, I believe, is broken. The numgen built into php/java/most languages is absolutely horrible.
I just had a game where I lost all but 1 8v8 attacks/defends in a 15 move series. I won 1 of 15. There are other random number generator options out there, could you look into these? Thanks. |
« First
‹ Previous
Replies 11 - 17 of 17
TheGrid wrote
at 2:45 AM, Wednesday January 10, 2007 EST Like i said, even perfect random will not stop people like notgonnatellyou2 complaining about having series of 8,12 or 16 so. THEY DO HAPPEN. Point. Even if you throw real dice.
|
no_Wolf wrote
at 1:33 PM, Wednesday January 10, 2007 EST "I once did a project on the law of large numbers using java.
It was disparagingly inaccurate over small series. " A-buh? As the grid said, isn't every random inaccurate in a small series? |
no_Wolf wrote
at 1:40 PM, Wednesday January 10, 2007 EST The biggest is a series of 12 ones in your random thingy, grid.
|
llam wrote
at 1:53 PM, Wednesday January 10, 2007 EST I don't really see why it matters. Your bizarre string of horrible luck is someone else's bizarre string of great luck, and vice versa, and as long as it's not targeting specific people for specific kinds of improbability it's still random overall in that sense.
|
no_Wolf wrote
at 2:31 PM, Wednesday January 10, 2007 EST Oooh! I got a 19 ones!
|
TheGrid wrote
at 5:26 PM, Wednesday January 10, 2007 EST ;)
I find it "funny", nobody yet "complained" here on the forums about having an unbelievable series of wins... |
the brain wrote
at 10:02 PM, Wednesday January 10, 2007 EST Pseudo random numbers are fine for a game this. With a period of 2^48 random numbers there are enough combinations to make it at least appear random enough (which does not mean absence of win/loss series, for example, about 1 in 1000 15 move series will show the results notgonnatellyou2 describes (1 win, 14 losses: 15 * 0.471^1 * 0.529^14)).
However, there are some things I can suggest to Ryan: - In the ideas section I saw you used "(int)(Math.random()*6)+1" to roll a dice. This puts a bias on the most significant decimals of the 'random' number. This may in turn result in a bias towards some rolls. Using "generator.nextInt(6) + 1" (with generator = new Random()) will remove this bias. - Let all tables use the same random number generator. This makes the generated numbers a bit more random as the timing from every table adds entropy. A multithreaded java program using Math.random() will already do this, but as I don't know the exact setup you might want to check this. - A more difficult adjustment could be to not generate the dice values individually, but to use the chance distribution directly. So for a 2-dice territory you generate a number from 2-12 according to the chance distribution, instead of each dice individually. This way you would take longer to fill the period of the random number generator. Personally I don't think any of these adjustments are truely necessairy, as the bias they would solve is likely to be small, and above all, the bias is towards the dice rolls, not any player in particular. |