Author: Tony Werten
Date: 02:43:49 11/04/02
Go up one level in this thread
On November 04, 2002 at 04:59:03, Uri Blass wrote: >On November 04, 2002 at 04:32:20, Severi Salminen wrote: > >>>I can see randomize when I click F1 only as a visual basic command and I work in >>>C. >>> >>>I tried srand(0) before filling the array but it does not help and >>>zobrist[0][0][0] is different in debug mode and in release mode. >> >>Are you sure? I think rand() should return the exact same values if you use the >>same seed (srand()). Are you sure you run srand(0) and fill the table only once >>in both versions? There seems to be a bug somewhere. >> >>Severi > >I do not know maybe the problem is that I use rand64 for 64 bits numbers > >Here is the beginning of my code > >int main(void) >{ > char s[256]; > int i=0; > char sizehash[9]="aaaaaaaaa"; > int hash_in_mbytes=0; > FILE *hashfile=fopen("movei137info.txt", "r+t"); > int fil,j; > srand(0); > for (fil=0;fil<6;fil++) > for (i=0;i<2;i++) > for (j=0;j<64;j++) > zobrist[fil][i][j]=rand64(); > printf(" %d ",(zobrist[0][0][0]&1048575)); > > >In debug mode I get 229414 and in release mode I get 172695. > > >If I use rand instead of rand64 I get 38 in both cases >Here is my function rand64 that is in another file in my project. > >__int64 rand64() >{ > return rand()^((__int64)rand()<<15)^((__int64)rand()<<30)^ > ((__int64)rand()<<45)^((__int64)rand()<<60); >} > It can't be a coincidence that all 3 of your numbers are way too small. Try using 5 local variables (int64). Xor everything for result. ( so all local variables have the shift already) I think that if you check the local variables you'll find the problem. Tony > >Uri
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.