-
-
Notifications
You must be signed in to change notification settings - Fork 436
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 DistString trait #1133
Add DistString trait #1133
Conversation
Looks good to me. We might want to generalize this to allow bulk generation of vectors. Such an API might benefit more from SIMD than our current one. |
What did you have in mind? A My understanding is that the unique challenge here is that asserting a bunch of bytes is a valid UTF-8 |
I guess I wanted to unify this with the |
You mean like How would |
I think we would still need a different trait for strings, for the reason you mentioned, I just think the interfaces could be more uniform. |
It's already possible to do something like this: let mut v: Vec<f32> = iter::repeat(f32::NAN).take(20);
use rand::Fill;
v[..].try_fill(&mut rand::thread_rng())?; That still requires initialisation but skipping that is #1080 ... we're way off topic. Anyway, we can wait a couple of days to give @abonander and @qoh a chance to review this if they're interested. Then it's time to review the change-log for the next patch release. |
@dhardy This looks fine to me but I thought you preferred to keep the interface simple? |
It's one trait plus two impls, so reasonably simple. |
I'm working on a SIMD alphanumeric |
Closes #1128. Review @vks, @abonander.
Thoughts? Not quite sure myself; it may be more natural to have
rng.gen_string(Alphanumeric, 20)
.