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

std.random.randomCover and randomSample should warn that struct RNGs are copied (original is not updated) #10347

Open
dlangBugzillaToGithub opened this issue Aug 14, 2018 · 1 comment

Comments

@dlangBugzillaToGithub
Copy link

n8sh.secondary reported this on 2018-08-14T11:03:07Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=19168

CC List

  • greensunny12

Description

The behavior is described in https://issues.dlang.org/show_bug.cgi?id=7067. Since the `rng` parameter is `auto ref` this behavior is not obvious merely from the function signature, so at the very least this quirk should be mentioned in the documentation.
@dlangBugzillaToGithub
Copy link
Author

greensunny12 commented on 2018-08-15T13:22:08Z

Better ways:

- split in two overloads and deprecate the by value one
- fix random ranges in general by making them non-copyable (like suggested in #7067)

However, the latter is a lot of work and it might be easier to just submit a version of mir.random as std.experimental.random and to fully replace std.random (there has been some talk about doing this, but it never materialized.)

@LightBender LightBender removed the P3 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants