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

[API Proposal]: Be able to set a Int64 and Int128 seed to Random #110892

Open
Mrgaton opened this issue Dec 22, 2024 · 7 comments
Open

[API Proposal]: Be able to set a Int64 and Int128 seed to Random #110892

Mrgaton opened this issue Dec 22, 2024 · 7 comments
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime untriaged New issue has not been triaged by the area owner

Comments

@Mrgaton
Copy link

Mrgaton commented Dec 22, 2024

Background and motivation

The current System.Random class does not allow initializing with a seed longer than a 32-bit integer. This proposal suggests introducing an API that supports initializing a Random instance with a longer seed (e.g., a byte[] or ReadOnlySpan).

API Usage

new Random(3435734875763456)

@Mrgaton Mrgaton added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Dec 22, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 22, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 22, 2024
@Mrgaton
Copy link
Author

Mrgaton commented Dec 22, 2024

If posible add it to net 9

@Mrgaton Mrgaton changed the title [API Proposal]: Be able to set a long seed to Random [API Proposal]: Be able to set a Int64 and Int128 seed to Random Dec 22, 2024
@Sergio0694
Copy link
Contributor

This proposal is not really actionable, as is. When creating an API proposal, please follow the template and fill in the requested info, don't remove sections like you did. At the very least, there should be an actual API proposal, which is entirely missing here. Consider updating your post to include it. You can look at other API proposal that have been approved, as a reference.

"If posible add it to net 9"

Absolutely not possible, since .NET 9 has already shipped.

@Sergio0694 Sergio0694 added the api-needs-work API needs work before it is approved, it is NOT ready for implementation label Dec 22, 2024
@MihaZupan
Copy link
Member

Looks like a duplicate of #21908

I think the main thing that's missing from the proposal is the motivation behind needing such APIs.

@Mrgaton
Copy link
Author

Mrgaton commented Dec 22, 2024

This proposal is not really actionable, as is. When creating an API proposal, please follow the template and fill in the requested info, don't remove sections like you did. At the very least, there should be an actual API proposal, which is entirely missing here. Consider updating your post to include it. You can look at other API proposal that have been approved, as a reference.

"If posible add it to net 9"

Absolutely not possible, since .NET 9 has already shipped.

I don't know to do api proposal as i'm not that expert to write nice looking api.

@Mrgaton
Copy link
Author

Mrgaton commented Dec 22, 2024

Looks like a duplicate of #21908

I think the main thing that's missing from the proposal is the motivation behind needing such APIs.

:C

@huoyaoyuan
Copy link
Member

Things are more complicated now when different random algorithms are involved.
Currently, when a seed is provided, Random will choose the "compatible" implementation, which as an algorithm with a fixed 32-bit degree of freedom. It's not meaningful to provide more bits to its seed.

@MihaZupan MihaZupan added area-System.Runtime and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 22, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants