Add list_shuffle
and list_sample
funtions to random
.
#14
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.
This will resolve #13. The function's algorithm and doc strings (include example) were ported fatefully from the
gleam_stdlib
.However, there is a need to create some internal functions
std_int
andstd_float
that act more like theirs counterpart in thegleam_stdlib
, because:int.random
doc: "The lower number is inclusive, the upper number is exclusive."float.random
doc: "Generates a random float between the given zero (inclusive) and one (exclusive)."The
prng
lib currently doesn't support generates number with one end or both end exclusive. So I have to make some ad-hoc functions that do it.I also try to make the test for these two functions, but I don't feed like I can write it the right way...