getify / Functional-Light-JS

Pragmatic, balanced FP in JavaScript. @FLJSBook on twitter.
http://FLJSBook.com
Other
16.6k stars 1.96k forks source link

fix random range for stock index #161

Closed ItaHeld90 closed 6 years ago

ItaHeld90 commented 6 years ago

In chapter 9 demo project, you use a function randInRange to return a random stock index. As The upper bound, you send stockIds.length - 1, though the upper bound is exclusive. I changed it to stockIds.length.

### Note: Currently this small bug presents no symptoms, coincidentally, due to another bug (See #160) that adds a redundant item to the array. After the fix presented in #160, the last stock never receive any updates.

getify commented 6 years ago

'randInRange(..)' is supposed to be inclusive of the upper range.

ItaHeld90 commented 6 years ago

Opened a new PR regarding the randInRange upper bound.