Beiträge anzeigen

Diese Sektion erlaubt es ihnen alle Beiträge dieses Mitglieds zu sehen. Beachten sie, dass sie nur solche Beiträge sehen können, zu denen sie auch Zugriffsrechte haben.


Nachrichten - vladimirsitnikov

Seiten: [1]
1
Here's what _ARRAY_SHUFFLE uses:
stop := UINT_TO_INT(SHR(size,2)-1);
FOR i := 0 TO stop DO
        pos := RDM2(i+pos,0,stop);
        (* swap elements *)
        temp := pt^[i];
        pt^[i] := pt^[pos];
        pt^[pos] := temp;
END_FOR;

Technically speaking, for Fisher–Yates shuffle (see https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) a loop of length "size" is required, not "size/2-1".

Does it make sense to correct the shuffle so it implemets Fisher-Yates properly?

2
Hi,

RDM, RDM2, RDMDW seems to be using weak random number generators. The generators are using floating point arithmetics (including divisions), thus they are somewhat slow.

What do you think if the random number generator was replaced with some well-known one?
For instance: xoroshiro128+ (see http://xoroshiro.di.unimi.it/)

xoroshiro128+ requires just 4 DWORDs for internal state, and it uses just shifts, additions and xors, so it should be way faster than current OSCAT generators.

Here's a C code: http://xoroshiro.di.unimi.it/xoroshiro128plus.c (it uses several 64-bit shifts/xors and one 64-bit addition, however all of that can be easily converted to 32bit DWORDs)

By the way: are OSCAT sources somewhere at github?

Seiten: [1]