Skip to content

[Refactor API] Separate Rand and Source #1589

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

Open
peter-jerry-ye opened this issue Feb 5, 2025 · 0 comments · May be fixed by #1910
Open

[Refactor API] Separate Rand and Source #1589

peter-jerry-ye opened this issue Feb 5, 2025 · 0 comments · May be fixed by #1910

Comments

@peter-jerry-ye
Copy link
Collaborator

Currently the Rand is bascially an implementation of ChaCha8, which is not ideal, as we want to provide multiple random number algorithms for different occasions. For example, we may want LCG as its fast and straightforward when we do not need cryptographic security.

A possible solution is to follow go's path, defining a Source trait, and define Rand as a wrapper around it:

pub(open) trait Source {
  next() -> UInt64
}

type Rand &Source

The migration, however, will break a couple of APIs, notably the new function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant