-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the rand
module
#100
Add the rand
module
#100
Conversation
revert(modules): Remove `byte`/`byte_range` functions chore: Add `rand` example script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Module looks great. Could you remove and .gitignore
the .idea
files?
My impression of IntelliJ is that it does just fine importing projects. And I won't be able to keep them up-to-date seeing as I don't use it. It's different with e.g. .vscode/launch.json
, since this is just a generic launch configuration. But an incomplete .idea
project listing seems like it could cause editor confusion!
Also looking forward to #73, so we can get somewhere to put api docs :). |
} | ||
|
||
/// Generate a random integer | ||
fn int(&mut self) -> Value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR, these can simply return i64
. Conversion is handled by Rune (for any type implementing the ToValue
trait). Returning a Value
doesn't hurt though!
Thank you! |
Adds the
rand
module.Exposes two types:
rand::WyRand
andrand::Pcg64
, which are RNGs. Each has the following functions:int() -> Integer
andint_range(lower: Integer, upper: Integer) -> Integer
In addition,
rand::int[_range]
exposes a single-use WyRand generator