Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
Add some checks in numFromHash
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstep committed Nov 2, 2017
1 parent 8ff3ade commit ab4a38d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/model/DApps/DApps.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ class _DCLib {
numFromHash(random_hash, min=0, max=100) {
if (min > max) { let c = min; min = max; max = c }
if (min==max) return max


if (random_hash.length > 3 && random_hash.substr(0,2)=='0x' ) {
random_hash = random_hash.substr(2)
}

max++
return Utils.bigInt(random_hash,16).divmod(max-min).remainder.value + min
}
Expand Down

0 comments on commit ab4a38d

Please sign in to comment.