Algorithm software?

Place to talk about all that new hardware and decaying software you have.

Moderator: General Mods

Post Reply
ReRuss
Trooper
Posts: 443
Joined: Sun Aug 15, 2004 9:49 pm
Location: Somewhere
Contact:

Algorithm software?

Post by ReRuss »

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
[img]http://i5.photobucket.com/albums/y180/ReRuss/UBAR.gif[/img]
360 and PS3 - ReRuss
funkyass
"God"
Posts: 1128
Joined: Tue Jul 27, 2004 11:24 pm

Post by funkyass »

take a statsitics course.

basically, excel can do this. run 100 or so samples, and graph it.
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

Here's a page that covers lots of randomness measurement methods: http://www.lavarnd.org/what/nist-test.html
ReRuss
Trooper
Posts: 443
Joined: Sun Aug 15, 2004 9:49 pm
Location: Somewhere
Contact:

Post by ReRuss »

Thanks for the info , I also tried free software for roulette and between me and my friend we couldn't get more than 2 or three correct guesses which were vague (red/black)
[img]http://i5.photobucket.com/albums/y180/ReRuss/UBAR.gif[/img]
360 and PS3 - ReRuss
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

I just happen to have this on my key...

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);
}
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

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Post Reply