jeopardy 0.0.26 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f2e4ec7a88258a44bd43c227c69e7fea652b1ad
4
- data.tar.gz: 687ee8d39fcc775e55d3f373ed5fbb1f31fe69d4
3
+ metadata.gz: b00543a1943b64e156309218d403ca767064d03b
4
+ data.tar.gz: 4615237f8e14a3c4419a001f87e09fa0b17515d5
5
5
  SHA512:
6
- metadata.gz: e09c4d840e98e26241e9a759c893a50310285115de97b17dc57d7bd07105e2c2bf578684fabaab58838d3a93358d90b8f7b716f6f84645c3e6366e45e501c9f0
7
- data.tar.gz: d4b0a0d3aa98c4310a3aed295373ac629ba1bf2b4115669af8e6b46336c1c54c15a7898a8863a21180df1b726e40661c37f9c9220f249a4e684212034e4f1736
6
+ metadata.gz: a8733eba542d195357ab1969655f19603c13a72ed52571638db0b1844f691d128bd9962bb3c6be8acbd16723db4d069a3b7be6c017d9a9d6ad47efec19436d0a
7
+ data.tar.gz: d288f0d9b48ab512e40c0b58c5b42181ffef10a72ba21e48bfbfb9487d0761505522421f5833055f4e42a862a4da1d5b919acfcd375f5ff7af02c9d8702772c0
@@ -3,7 +3,6 @@
3
3
  #include <string.h>
4
4
  #include <stdlib.h>
5
5
  #include <math.h>
6
- #include "ruby.h"
7
6
  #include "MinMax.h"
8
7
 
9
8
  double sampleNormal()
@@ -1,6 +1,7 @@
1
1
  #include "ruby.h"
2
2
  #include "Game.h"
3
3
  #include <time.h>
4
+ #include <limits.h>
4
5
 
5
6
  VALUE Jeopardy;
6
7
  VALUE rbGame;
@@ -198,20 +199,21 @@ static VALUE simulate(int argc, VALUE *argv, VALUE self)
198
199
  VALUE trials_key = ID2SYM(rb_intern("trials"));
199
200
  VALUE seed_key = ID2SYM(rb_intern("seed"));
200
201
  rb_hash_set_if_nil(options, trials_key, INT2NUM(1));
201
- rb_hash_set_if_nil(options, seed_key, INT2NUM(time(NULL)));
202
+
203
+ VALUE rbRandom = rb_const_get(rb_cObject, rb_intern("Random"));
204
+ VALUE new_seed = rb_funcall(rbRandom, rb_intern("rand"), 1, UINT2NUM(UINT_MAX));
205
+ rb_hash_set_if_nil(options, seed_key, new_seed);
202
206
 
203
207
  VALUE trials = rb_hash_aref(options, trials_key);
204
208
  VALUE seed = rb_hash_aref(options, seed_key);
205
209
 
206
- Check_Type(trials, T_FIXNUM);
207
- Check_Type(seed, T_FIXNUM);
210
+
208
211
  if (NUM2INT(trials) < 1)
209
212
  {
210
213
  rb_raise(rb_eArgError, "The number of trials a game is simulated must be greater than zero.");
211
214
  }
212
215
 
213
- srand(NUM2INT(seed));
214
- srand48(NUM2INT(seed));
216
+ srand(NUM2LL(seed));
215
217
 
216
218
  Game game = c_game(self);
217
219
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeopardy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devin Shelly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A fast Monte Carlo simulation of the television game show Jeopardy!
14
14
  email: devin@devinshelly.com