Author: Robert Hyatt
Date: 08:00:43 05/22/01
Go up one level in this thread
On May 22, 2001 at 09:52:11, Gian-Carlo Pascutto wrote: >On May 22, 2001 at 09:43:49, Robert Hyatt wrote: > >>>2) How to generate a 64 bit random number? (I use ran()*ran(). Is it OK?). >> >>I would use ran()<<32 + ran myself. > >Just make sure you package your own ran(). The quality of C >libraries one will vary greatly. > >I did a test with 32 bit hashes and MSVC: average hamming distance >of 9.30, whereas my own (which I stole from Crafty, which stole it from...) >got 15.99, which is theoretically optimal I suppose. Mine came from "Numercial Recipes" which has all sorts of pre-coded things in it. The RNG is very good (I think it was the same thing as was proposed by Knuth in fact..). > >>>6) I use the operation addition for making new hash key. Certainly, it is >>>slower >>>than XOR, but anything else? (I heard one time about it, but forgot). >> >>XOR is better. and easier to undo when you take back a move. If you use >>add, you can get overflows and when you later subtract, you can have a problem. > >If you do addition/subtraction modulo 2^32, you will not have that problem. >Most architectures do that by default. If your compiler has range checking >it will complain though. > >-- >GCP
This page took 0 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.