Permalink
Browse files

Ensure prize in lottery is never negative

  • Loading branch information...
petercollingridge committed Mar 22, 2013
1 parent c66b1c4 commit d7139b815056fb2cad513cdb0c857e594e363eaa
Showing with 3 additions and 3 deletions.
  1. +3 −3 exercises/expected_value.html
@@ -191,11 +191,11 @@
<div id="lottery" data-weight="2">
<div class="vars">
<var id="BUY">random() &lt; 0.4</var>
- <var id="COST">randRange(2,4)</var>
+ <var id="COST">randRange(2,5)</var>
<var id="ODDS">randRange(1,5)*100</var>
<var id="PRIZE">BUY ?
- COST*ODDS + randRange(1,3)*100 :
- COST*ODDS - randRange(1,3)*100
+ COST*ODDS + randRange(1, 6) * 50 :
+ COST*ODDS - randRange(1, COST * 2 - 1) * 50
</var>
<var id="ODD_F">fraction(1,ODDS,true,true)</var>
<var id="ANS">BUY ?

0 comments on commit d7139b8

Please sign in to comment.