Author: Edward Seid
Date: 09:40:12 11/01/03
The .NET Framework Class Library(FCL) has a Random class used to generate random
numbers. With help from the BitConverter class, I've come up with a routine
that generates 8 random bytes, and concatenates these together to yield a signed
64-bit number (Long in .net speak). Since it uses FCL classes, anyone writing
in a .NET language (C#, Managed C++) can adapt it to their project.
Does this sound OK for chess hashing/transposition tables?
Also, in relation to another recent thread here on 64-bit random numbers, why do
people bother coding their own RNGs instead of using the RNG functions of
whatever compiler their using? Does it really make that much difference?
TIA.
--- VB.NET Code Start ---
Dim randomNumber As Random = New Random()
Dim randomBytes As Byte() = New Byte(7) {}
Dim randomLong As Long
randomNumber.NextBytes(randomBytes)
randomLong = BitConverter.ToInt64(randomBytes, 0)
--- VB.NET Code Ends ---
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.