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

lib/rand: Break out random functions into separate package #3186

Closed
wants to merge 1 commit into from
Closed

lib/rand: Break out random functions into separate package #3186

wants to merge 1 commit into from

Conversation

calmh
Copy link
Member

@calmh calmh commented May 25, 2016

Purpose

The intention for this package is to provide a combination of the security of crypto/rand and the convenience of math/rand. It should be the first choice of random data unless ultimate performance is required and the usage is provably irrelevant from a security standpoint.

Testing

Not changed.

The intention for this package is to provide a combination of the
security of crypto/rand and the convenience of math/rand. It should be
the first choice of random data unless ultimate performance is required
and the usage is provably irrelevant from a security standpoint.
func init() {
// The default RNG should be seeded with something good.
mathRand.Seed(RandomInt64())
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess cryptorand doesn't need seeding?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed. I debated removing this, but we still use math/rand in a few places, and having it seeded by default somewhere is better than not doing it. We should do a cleanup later to not use math/rand anywhere, unless we need the predictable seeding or can show that we need the better performance of that package. And I don't think we ever need the performance as we're not generating that much random things

@AudriusButkevicius
Copy link
Member

@st-review merge

@st-review
Copy link

👌 Merged as e6b78e5. Thanks, @calmh!

@st-review st-review closed this May 26, 2016
st-review pushed a commit that referenced this pull request May 26, 2016
The intention for this package is to provide a combination of the
security of crypto/rand and the convenience of math/rand. It should be
the first choice of random data unless ultimate performance is required
and the usage is provably irrelevant from a security standpoint.

GitHub-Pull-Request: #3186
@calmh calmh deleted the insecrand2 branch May 26, 2016 07:43
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jun 16, 2017
@syncthing syncthing locked and limited conversation to collaborators Jun 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants