User Name: Password:
New User Registration
Moderator: SueQ , coan.net 
 Backgammon

Backgammon and variants.

Backgammon Links


List of discussion boards
Mode: Everyone can post
Search in posts:  

13. October 2012, 14:36:42
Aganju 
Subject: Re: Lots o' fives
playBunny: I think you misunderstood me. Of course, seeding every time as well as seeding only with the minutes is not a good idea; this was my try to reverse-engineer the experienced behavior here on BK. As I wrote below, if I play a move in five games within one minute, all my opponents have the same roll afterwards. That seems to point to
a) the roll for the opponent is made the moment I send my move, and
b) the minute is used for seeding every time,
so that would explain why they all have the same roll. That's only a guess, of course, but one that explains what's happening.
Because all my opponents answer at different times, typically this is not very obvious, but if you note it down, you can check the games and verify that they all roll equal.

A good (pseudo-)random number generator consists of multiplying a stored number with a large prime, and dividing by another large prime, the division result is stored for the next round, and the division rest is normalized to be used as the 'random' number. The quality and equal distribution of the resulting sequence depends on the choice of the two primes, and as part of my work, we analyzed all primes up to 1 billion for their resulting random number quality. I have kept the best result (I hope), and will look it up later and post it here.

I know that Fencer is rather good at what he does, and I know that a lot of people whined already about the random numbers here on BK, so I just gave up complaining myself. I just answered to someone else's comment about five times 5-5 in a row, and that it is unfortunately quite common to see that in opponents rolls if you play fast.
...

Here is the C++ code from ~2001 with the best possible random numbers for numbers below 1 billion. It will return a
double between 0 and 1, and needs to be normalized to the target interval (backgammon: 1-6).

double Rnd::Double (void)
/* Linearer Kongruenzgenerator nach Afflerbach
x[i+1] = x[i] * 27132 + 1 (mod 62748517), z[i] = x[i] / 62748517
Periodenlaenge 62748517, Beyer-Quotienten 0.969, 0.922, 0.819
Bestmoegliche Verteilung fuer Modul m <1e9 */
{
static unsigned long xi = 0;
int i;
unsigned long z = 0;

if (xi == 0) xi = (unsigned long) time(NULL);

for (i=30; i>0; i--) {
z <<= 1;
if (xi & (1L << (i-1))) z += 27132L;
while (z> 62748516L) z -= 62748517L;
}
xi = z + 1L;
return ((double) xi / 62748517.0);
}

Date and time
Friends online
Favourite boards
Fellowships
Tip of the day
Copyright © 2002 - 2024 Filip Rachunek, all rights reserved.
Back to the top