Skip to content

Conversation

@dhardy
Copy link
Member

@dhardy dhardy commented Nov 10, 2025

This was mentioned elsewhere: rust-random/rand#1675

Adds rand_core as a dependency, which is one small crate.

This attempts to enable testing of rng in all CI tests.

@dhardy
Copy link
Member Author

dhardy commented Nov 18, 2025

@newpavlov your opinion on this please?

There is an alternative: the rand_os crate. I slightly prefer fewer crates but either is acceptable.

@newpavlov
Copy link
Member

As I wrote previously, personally, I have a slight preference for a separate crate. But I would be fine with this PR as well, if others prefer it.

P.S.: Note that rand_os recently got an "unmaintained" advisory: rustsec/advisory-db#2462

Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

As I wrote previously, personally, I have a slight preference for a separate crate. But I would be fine with this PR as well, if others prefer it.

I think I would slightly lean towards having this as part of getrandom. A non-default additive feature seems like a good fit. I think the only complexity is figuring out what (if anything) this crate should re-export from rand_core.

@dhardy
Copy link
Member Author

dhardy commented Nov 19, 2025

Thanks for moving this forward @josephlr. I think I addressed your concerns (except as commented).

@dhardy
Copy link
Member Author

dhardy commented Nov 21, 2025

@newpavlov I addressed your concerns

@newpavlov
Copy link
Member

newpavlov commented Nov 23, 2025

@josephlr
WDYT? It looks like the only unresolved question is whether we need to introduce UnwrappedSysRng or not.

@dhardy
Please add #![cfg_attr(docsrs, feature(doc_cfg))] as per the comment above and add a changelog entry.

@newpavlov newpavlov changed the title Add OsRng to getrandom Add SysRng to getrandom Nov 23, 2025
@newpavlov newpavlov changed the title Add SysRng to getrandom Add feature-gated SysRng type implementing rand_core traits Nov 23, 2025
@dhardy
Copy link
Member Author

dhardy commented Nov 24, 2025

@newpavlov see lib.rs:12.

@dhardy
Copy link
Member Author

dhardy commented Nov 24, 2025

A consequence of renaming the feature to sys_rng is:
image
Would it be better just to name the feature rng?

@dhardy
Copy link
Member Author

dhardy commented Nov 24, 2025

I added UnwrappedSysRng (with a slight doc tweak)

@newpavlov
Copy link
Member

What about changelog?

It could worth to add test_unwrapped_sys_rng.

Would it be better just to name the feature rng?

Personally, I don't see a problem with the provided rendering.

@dhardy
Copy link
Member Author

dhardy commented Nov 24, 2025

Added CHANGELOG entry and test case.

@newpavlov newpavlov changed the title Add feature-gated SysRng type implementing rand_core traits Add SysRng and UnwrappedSysRng behind new feature sys_rng Nov 24, 2025
@newpavlov newpavlov changed the title Add SysRng and UnwrappedSysRng behind new feature sys_rng Add SysRng behind new feature sys_rng Nov 24, 2025
@dhardy dhardy merged commit 6cbbcb4 into master Nov 24, 2025
75 checks passed
@dhardy dhardy deleted the push-tqlwtzsrywpy branch November 24, 2025 11:23
Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

LGTM (sorry for the delay on review), will respond about UnwrappedSysRng in #754

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.

4 participants