diff options
| author | HIRO-R-B <[email protected]> | 2020-12-05 18:18:10 -0800 |
|---|---|---|
| committer | Amir Rajan <[email protected]> | 2020-12-06 09:46:28 -0600 |
| commit | ee69d1ef44889a8e22752c6d466b10765b3461ca (patch) | |
| tree | 066bde89a8857fed16bb3c11a67f36acd7a09685 | |
| parent | 94bb55408f150db9277193628dfdfb6f5871af64 (diff) | |
| download | dragonruby-game-toolkit-contrib-ee69d1ef44889a8e22752c6d466b10765b3461ca.tar.gz dragonruby-game-toolkit-contrib-ee69d1ef44889a8e22752c6d466b10765b3461ca.zip | |
Bugfix Numeric#randomize
Rearranged if clause order so that `:sign` opt works with `:int` and `:ratio` opts
| -rw-r--r-- | dragon/numeric.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dragon/numeric.rb b/dragon/numeric.rb index bf73b1b..548e0e2 100644 --- a/dragon/numeric.rb +++ b/dragon/numeric.rb @@ -140,16 +140,16 @@ S def randomize *definitions result = self - if definitions.include?(:sign) - result = rand_sign - end - if definitions.include?(:ratio) result = rand * result elsif definitions.include?(:int) result = (rand result) end - + + if definitions.include?(:sign) + result = result.rand_sign + end + result end |
