[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnubg] Rotating rolls in rollout
From: |
nis |
Subject: |
Re: [Bug-gnubg] Rotating rolls in rollout |
Date: |
Fri, 04 Oct 2002 15:19:26 +0200 |
--On 04 Oct 2002 13:44 +0200 Jim Segrave <address@hidden> wrote:
On Fri 04 Oct 2002 (13:23 +0200), Nis Jorgensen wrote:
Perhaps something like this (pseudocode)
RollUsed(TrialNumber,Rollnumber) =
Sum for k = 0 to (Rollnumber - 1)
of
((Trialnumber div (36^k)) mod 36)
mod 36
What happens to the results if you do something simple minded like:
create an array of rolls with
1296 elements. Initialise with 1111 1112 1113 .. 6664 6665 6666
Use the seed to randomise the array - for example, generate two
random nos. i and j in the range 0..1295 and swap array[i] with
array[j]. Repeat at least 648 times.
That is not a good randomization strategy. You should do
For i = 0 to 1295
create random j between i and 1295
swap array[i] and array[j]
Next
Then by a simple proof by induction, the array is as random as your random
numbers.
This does not, however, provide the maximum stratification if the number of
trials is not a multiple of 1296. Thus I would prefer to put a little more
effort into creating the array of rolls. My best idea so far is to cycle
the first roll through the same sequence of 36 rolls, and cycling the
second roll through the same sequence, but 'sliding' the sequence before
each sequence of 36. Something like (still pseudocode:
Create array36 containing 11,12,...,66
Randomize Rolls36 as described before
Create empty array of 1296
for i = 0 to 35
for j = 0 to 35
array[i*36+j] = (array36[j], array36[i+j mod 36])
Then use this array sequentially (and circularly, dropping initial
doubles when rolling out initial positions) to supply the first two
rolls. This gives you a pseudo-random but repeatable set of roll
pairs and the processor cost is not very high - filling the array and
randomising it is relatively cheap, after that, during the rollouts
you don't have to keep track of what you've used.
I am not sure about "dropping the initial doubles" during the rollout. I
think rather we should make an array of 30*36 for that case.
--
Nis Jorgensen
Amsterdam
RE: [Bug-gnubg] Rotating rolls in rollout, Ian Shaw, 2002/10/04
Re: [Bug-gnubg] Rotating rolls in rollout, Douglas Zare, 2002/10/04
Re: [Bug-gnubg] Rotating rolls in rollout, Robert-Jan Veldhuizen, 2002/10/04