Skip to content

Conversation

amralgendi
Copy link
Contributor

Fixed limit of Random.nextInt()

Fixed limit of Random.nextInt()
Copy link

@shreyashHake shreyashHake left a comment

Choose a reason for hiding this comment

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

It can also be
int randInx = new Random().nextInt(100);
as the initial size is 100 specified at line 17,
which is eventually same to list.size() as Random(n) -> gives value from (0 to n -1).

@HarryDulaney
Copy link
Owner

Nice! Yea, in this case, I like using list.size(). The shuffle(ArrayList list) method is more flexible to different-sized inputs that way. Thank you for your contributions!

@HarryDulaney HarryDulaney merged commit dc0debe into HarryDulaney:master Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants