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 support for std::sample #12

Closed
SuperWig opened this issue Mar 1, 2019 · 2 comments
Closed

Add support for std::sample #12

SuperWig opened this issue Mar 1, 2019 · 2 comments

Comments

@SuperWig
Copy link

SuperWig commented Mar 1, 2019

https://en.cppreference.com/w/cpp/algorithm/sample

@ilqvya
Copy link
Owner

ilqvya commented Mar 4, 2019

As workaround you can use Random::get_engine()

But it returns its engine by value...

I think it would be nice to have access to an internal engine by reference to avoid such problem, and do not wrap every new API which requires random number generator

I'll add it soon

@ilqvya
Copy link
Owner

ilqvya commented Mar 31, 2019

Now you're able use any external algorithm that requires random engine as parameter

std::sample(itBeg, itEnd, std::back_inserter(out), 5, Random::engine( ));

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

No branches or pull requests

2 participants