Hi need some guidance here.
I am developing a Zobrist hashing algorithm (https://en.wikipedia.org/wiki/Zobrist_hashing).
for the implementation, one needs to generate a series of random numbers and then XOR them. one can use 32 bits to generate the random numbers but it would be much better to be able to use use 64 bit.
a conceptual simplified idea (the actual alg needs 64 random numbers and then they are XORed is:
Is there a possibility to turn everything to 64bits in B4J? I have tried the below code but it crashes complaining that the rnd function bound must be positive. I guess that has to do with the fact that Java does not support unsigned type..
do you see potential workarounds?
thanks!
I am developing a Zobrist hashing algorithm (https://en.wikipedia.org/wiki/Zobrist_hashing).
for the implementation, one needs to generate a series of random numbers and then XOR them. one can use 32 bits to generate the random numbers but it would be much better to be able to use use 64 bit.
a conceptual simplified idea (the actual alg needs 64 random numbers and then they are XORed is:
B4X:
Dim MaxInt As Int,rndint As Int,key As Int, ii As Int
MaxInt = Power(2,31)
For ii = 0 To 63
rndint = Rnd(0,MaxInt)
key=Bit.Xor(key,rndint)
Next
.....
Is there a possibility to turn everything to 64bits in B4J? I have tried the below code but it crashes complaining that the rnd function bound must be positive. I guess that has to do with the fact that Java does not support unsigned type..
B4X:
Dim MaxLong As Long,rndlong As Int,keylong As Int, ii As Int
MaxLong = Power(2,63)
For ii = 0 To 63
rndlong = Rnd(0,MaxLong)
key=Bit.Xor(key,rndlong)
Next
do you see potential workarounds?
thanks!