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

Add Ints.shuffle() #3555

Open
leventov opened this issue Aug 10, 2019 · 6 comments
Open

Add Ints.shuffle() #3555

leventov opened this issue Aug 10, 2019 · 6 comments

Comments

@leventov
Copy link

There are very similar arguments applying to this question as to #502 (Add Ints.reverse()), the difference is that shuffle algorithm is a bit less trivial than reverse().

@netdpb
Copy link
Member

netdpb commented Aug 12, 2019

I don't see a lot of evidence of people needing to shuffle arrays of ints in Google's codebase. Do you see a lot of use of Collections.shuffle({Ints,Arrays}.asList(...)) in your codebase?

@leventov
Copy link
Author

leventov commented Aug 12, 2019

I find myself visiting this SO question to copy the code from time to time. This definitely happened more than three times. Avoiding Collections.shuffle(Ints.asList(a)) is a performance habit.

@ben-manes
Copy link
Contributor

See ArrayUtils#shuffle(int[]) in Apache Commons Lang3.

@Stupremee
Copy link

Can I implement this feature?

ksodhi2 added a commit to ksodhi2/guava that referenced this issue Dec 9, 2021
@sagada
Copy link

sagada commented Oct 14, 2023

@leventov
Hello!
I would like to take on this task as a first challenge.
Can I start working on it?

@netdpb
Copy link
Member

netdpb commented Oct 18, 2023

Hi @Stupremee and @sagada. Thanks for your interest in contributing!

Please take a look at How to Contribute. We haven't gotten to the point of deciding that this feature is worth adding to Guava, so we're definitely not ready to implement it. And often it's more work for us to accept a PR than it is for us to implement it ourselves. I'm afraid this is likely one of those cases.

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

No branches or pull requests

5 participants