/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to tests/random-d6.vala

  • Committer: Gustav Hartvigsson
  • Date: 2022-06-01 12:44:04 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20220601124404-mpv4761nr16f0duq
run_gdb.sh +x

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    
38
38
    Test.add_func ("/VQDR/Expression/Dice/d6/roll_count", () => {
39
39
      Dice d = new Dice ();
40
 
      int count[7] = {0};
41
 
      int rolls = 1000000;
 
40
      int32 count[7] = {0};
 
41
      int32 rolls = 1000000;
42
42
      for (size_t i = 0; i < rolls; i++) {
43
 
        int r = d.roll ();
 
43
        int32 r = d.roll ();
44
44
        
45
45
        count[r] += 1;
46
46
      }
47
 
      int total = 0;
48
 
      for (int i = 0; i < 6; i++) {
 
47
      int32 total = 0;
 
48
      for (int32 i = 0; i < 6; i++) {
49
49
        total += count[i];
50
50
      }
51
51
      
57
57
    
58
58
    Test.add_func ("/VQDR/Expression/Dice/d6/roll_probability", () => {
59
59
      Dice d = new Dice ();
60
 
      int count[7] = {0};
61
 
      int rolls = 1000000;
 
60
      int32 count[7] = {0};
 
61
      int32 rolls = 1000000;
62
62
      for (size_t i = 0; i < rolls; i++) {
63
 
        int r = d.roll ();
 
63
        int32 r = d.roll ();
64
64
        
65
65
        count[r] += 1;
66
66
      }
67
 
      for (int i = 0; i < 6; i++) {
 
67
      for (int32 i = 0; i < 6; i++) {
68
68
        print ("------------\n");
69
69
        print ("count for %d : %\n", i + 1, count[i] );
70
70
        double procentile = ((double )count[i] / rolls) * 100;