Make random consistent: never output the top of the bound #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
lume.random(1)
can sometimes return 1, butlume.random()
andlume.random(0,1)
will never return 1. (And the converse for zero: they should all be able to produce 0.) Change the single argument version to conform to the same range regardless of inputs. Update the documentation to make the output range explicit using language similar to math.random.Add a test that had two failures on the old code for the single argument
version:
FAIL test.lua:110: testeq(postcond.expected.count > 0, true)
Expected "true" got "false"
FAIL test.lua:111: testeq(postcond.unexpected.count, 0)
Expected 0.00 got 3.00
All tests pass.