Skip to content
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 custom RandomNumberGenerator source to Int.init?(randomBelow:) #44

Merged
merged 2 commits into from
Mar 25, 2020
Merged

Add custom RandomNumberGenerator source to Int.init?(randomBelow:) #44

merged 2 commits into from
Mar 25, 2020

Conversation

knothed
Copy link
Contributor

@knothed knothed commented Mar 2, 2020

This allows users to provide the RNG of their choice for creating pseudo-random integers.

I.e., instead of

let values = 100.timesMake { Int(randomBelow: 10) }

users could write:

var xoshiro = Xoshiro() // Some third-party RNG
let values = 100.timesMake { Int(randomBelow: 10, using: &xoshiro) }

This allows users to provide the RNG of their choice for creating pseudo-random integers.
Copy link
Member

@Jeehut Jeehut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, merging. Thank you very much!

@Jeehut Jeehut merged commit 1391e1c into FlineDev:stable Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants