Few days ago me and another friend were challenged to try and predict a digital casino on game our friend made (the roulette part anyway)
He wants to A) make sure theres no bugs , B) see if it truly random
I would say just look in the source , but his computer is generating the roulette so its server side
We're stumped (and and debating) at what algorithm method to try and if theres any software to aid in that (wheel is 0-36 , no 00 , simple light spinning , no ball)
Personally I would say exact or approximate would be the best to try , but what all data do I need to know and what formula would it need to be in?
I also am curious to try this in Vegas Stakes lol
Algorithm software?
Moderator: General Mods
Algorithm software?
[img]http://i5.photobucket.com/albums/y180/ReRuss/UBAR.gif[/img]
360 and PS3 - ReRuss
360 and PS3 - ReRuss
Here's a page that covers lots of randomness measurement methods: http://www.lavarnd.org/what/nist-test.html
-
- ZSNES Shake Shake Prinny
- Posts: 5632
- Joined: Wed Jul 28, 2004 4:15 pm
- Location: PAL50, dood !
I just happen to have this on my key...
Of course you'll have to manually interpret the results, but heh.
Runs your random func AMOUNT times and sorts the results into SIZE ranges.
For a decent random, you want D to remain constant at roughly AMOUNT/SIZE (each range has an equivalent chance of being hit), and V shouldn't hit zero (any 2 values can be spit consequently).
If D and V are constant, nice job, you've got a mostly homogeneous random func.
Code: Select all
#include <stdio.h>
#include <math.h>
#include <stdint.h> // whatever has the c99 types
#define SIZE 16 // max = 256
#define AMOUNT 131072 // max = 4G
double rand(); // 0 -> 0.999... (YOUR FUNCTION HERE)
int main()
{
uint32_t varia[SIZE], dist[SIZE], i = AMOUNT;
double step = 1.0/(double)SIZE, last = 0.5, cur;
memset(varia, 0, SIZE*sizeof(uint32_t));
memset(dist, 0, SIZE*sizeof(uint32_t));
do
{
cur = rand();
dist[(uint8_t)(cur/step)]++; // this oughta work...
varia[(uint8_t)(fabs(cur-last)/step)]++; // ...and so will this !
last = cur;
} while (--i);
for (; i<SIZE; i++)
{
printf("\n%3u: %f - %f\nD = %10u\nV = %10u\n", i, i*step, (i+1)*step,
dist[i], varia[i]);
}
return (0);
}
Runs your random func AMOUNT times and sorts the results into SIZE ranges.
For a decent random, you want D to remain constant at roughly AMOUNT/SIZE (each range has an equivalent chance of being hit), and V shouldn't hit zero (any 2 values can be spit consequently).
If D and V are constant, nice job, you've got a mostly homogeneous random func.
皆黙って俺について来い!!
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Code: Select all
<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)