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

Rename srand to Random.seed #27726

Closed
ChristianKurz opened this issue Jun 22, 2018 · 10 comments
Closed

Rename srand to Random.seed #27726

ChristianKurz opened this issue Jun 22, 2018 · 10 comments
Labels
deprecation This change introduces or involves a deprecation randomness Random number generation and the Random stdlib

Comments

@ChristianKurz
Copy link
Contributor

ChristianKurz commented Jun 22, 2018

I frequently need to look this up and it seems to be against the naming convention of spelling things out.
Other scientific languages do not use that syntax either:

  • R had srand but its deprecated, now uses set.seed()
  • MATLAB uses rng(seed)
  • Python uses random.seed()

While C actually uses srand, i think we want to improve upon C-Syntax?

Edit: There has been some short discussion about this in 2014

@ararslan ararslan added the randomness Random number generation and the Random stdlib label Jun 22, 2018
@rfourquet
Copy link
Member

I would also propose reseed!

@ViralBShah
Copy link
Member

I prefer something with rand in it. So seedrand.

@StefanKarpinski
Copy link
Sponsor Member

Yes, seedrand seems like a pretty good name.

@fredrikekre
Copy link
Member

Unexported Random.seed?

@ViralBShah
Copy link
Member

Since we do have randjump, why not go with randseed instead? Other option is to perhaps make them both unexported.

@rfourquet
Copy link
Member

Since we do have randjump, why not go with randseed instead?

I like the increased consistency (but see also bitrand), although it may sound to some like randseed would return a random seed, in the same way we have randperm and randstring producing random permutations and strings.

@ViralBShah
Copy link
Member

That is a good point.

@ChristianKurz
Copy link
Contributor Author

ChristianKurz commented Jun 29, 2018

So the choice is between seedrand and unexported Random.seed.
I like both, but I think Random.seed may be the better option:

  • it's reasonably short
  • seeding an RNG may not be considered beginners usage, so discoverability should not be a problem.
  • i like how Random stands out in the code for readability
  • it's the same in Python

@JeffBezanson JeffBezanson added deprecation This change introduces or involves a deprecation triage This should be discussed on a triage call labels Jul 19, 2018
@JeffBezanson
Copy link
Sponsor Member

If anybody wants this in 0.7, it needs to be done ASAP.

@StefanKarpinski StefanKarpinski removed the triage This should be discussed on a triage call label Jul 26, 2018
@StefanKarpinski
Copy link
Sponsor Member

Random.seed can happen if someone makes a PR in the next day, but this is not a release blocker.

@mbauman mbauman changed the title Rename srand to seedrand Rename srand to Random.seed Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation randomness Random number generation and the Random stdlib
Projects
None yet
Development

No branches or pull requests

7 participants