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

Unnecessary, obscure way to shuffle a list in the Advanced State and Side Effects codelab? #321

Open
lathanh opened this issue Jan 6, 2023 · 0 comments

Comments

@lathanh
Copy link

lathanh commented Jan 6, 2023

At the line linked below, shuffled given a Random whose seed is generated Randomly (which is not substantially different than not providing a Random at all). Why?

https://github.com/googlecodelabs/android-compose-codelabs/blob/37b4e639d3befcfd85885ba9cefceb26f8b32f5e/AdvancedStateAndSideEffectsCodelab/app/src/main/java/androidx/compose/samples/crane/home/MainViewModel.kt#L59

And if you want a number between 1 and 100, why shuffle a collection of 100 numbers rather than use Random.nextInt (1,101)?

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

No branches or pull requests

2 participants
@lathanh and others