09-28-2013, 03:23 PM
Hi there,
Lets start with the very basics of how a dice or Random number generator works. A dice is a cube shaped object with normally six (eight, ten or hundred) sides. These when thrown display a random number based on variables such as force, friction, gravity, physics, quantum mechanics and GODDAMN NINJA ASSAMITES!
RNG is what the jove program uses to replicate this effect (RNG stands for RANDOM NUMBER GENERATION). RNG is generated based on a SEED value. A seed value is a decimal point number between 0 and 1 that is used to figure out all future algorithms to generate the number. A seed value can be calculated from a variety of different components on your PC/ server but the most regular ones are internal clock time, CPU cycle and CPU temperature. Due to seed value only being calculated once and then used in future, the randomness of a virtual RNG isn't true randomness as you've no doubt noticed.
JOVE uses the bare basic random number generator and to put it plainly that's not very good. It's barely passable as random and this is why you'll notice dice rolled in close proximity to be almost identical. The edit I'm going to suggest is the MERSENNE TWISTER.
Many random number generators of older libcs have dubious or unknown characteristics and are slow. By default, PHP uses the libc random number generator with the rand() function. The mersenne twister in contrast uses a random number generator with known characteristics using the » Mersenne Twister algoritm, which will produce random numbers four times faster than what the average libc rand() provides. It'll also be significantly faster than the libc rand().
HOWEVER! The mersenne twister becomes biased towards even numbers when its max (optional highest number, in the case of a d10 dice, this should be 10) is above 2^32(4294967296)
To implement the Mersenne twister into the php code you simply change rand(); to mt_rand(); (If there's numbers in the brackets, keep those in!)
Lets start with the very basics of how a dice or Random number generator works. A dice is a cube shaped object with normally six (eight, ten or hundred) sides. These when thrown display a random number based on variables such as force, friction, gravity, physics, quantum mechanics and GODDAMN NINJA ASSAMITES!
RNG is what the jove program uses to replicate this effect (RNG stands for RANDOM NUMBER GENERATION). RNG is generated based on a SEED value. A seed value is a decimal point number between 0 and 1 that is used to figure out all future algorithms to generate the number. A seed value can be calculated from a variety of different components on your PC/ server but the most regular ones are internal clock time, CPU cycle and CPU temperature. Due to seed value only being calculated once and then used in future, the randomness of a virtual RNG isn't true randomness as you've no doubt noticed.
JOVE uses the bare basic random number generator and to put it plainly that's not very good. It's barely passable as random and this is why you'll notice dice rolled in close proximity to be almost identical. The edit I'm going to suggest is the MERSENNE TWISTER.
Many random number generators of older libcs have dubious or unknown characteristics and are slow. By default, PHP uses the libc random number generator with the rand() function. The mersenne twister in contrast uses a random number generator with known characteristics using the » Mersenne Twister algoritm, which will produce random numbers four times faster than what the average libc rand() provides. It'll also be significantly faster than the libc rand().
HOWEVER! The mersenne twister becomes biased towards even numbers when its max (optional highest number, in the case of a d10 dice, this should be 10) is above 2^32(4294967296)
To implement the Mersenne twister into the php code you simply change rand(); to mt_rand(); (If there's numbers in the brackets, keep those in!)