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

How does/does fill() work at all ? #49

Open
pillowtrucker opened this issue Jan 30, 2024 · 0 comments
Open

How does/does fill() work at all ? #49

pillowtrucker opened this issue Jan 30, 2024 · 0 comments

Comments

@pillowtrucker
Copy link

I was trying to generate some uuids and it seems that fill() just takes mutable references to temporary copies of the bytes in an array. I have to map the initial zeroed array and just use generate() to get it to work.

        let mut rng = nanorand::tls_rng();
        let random_bytes = [0; 16];
        let random_bytes = random_bytes.map(|_| rng.generate::<u8>());

the above works

        rng.fill(random_bytes);
        rng.fill_bytes(random_bytes);

the above two do nothing, regardless of the declared mutability of random_bytes

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

1 participant