spec/javascripts/src/util/random_spec.js in entityjs-0.3.1 vs spec/javascripts/src/util/random_spec.js in entityjs-0.3.2

- old
+ new

@@ -18,9 +18,26 @@ ok(n <= 3) } }); + it('should get one or the other', function(){ + + var first = false; + var second = false; + + for(var i = 100; i--;){ + var n = re.random([-10, 10]); + if(n == 10) first = true; + if(n == -10) second = true; + ok(n == -10 || n == 10) + } + + ok(first) + ok(second) + + }); + it('random -10 to 10', function(){ for(var i = 100; i--;){ var n = re.random(-10, 10); ok(n >= -10)