Skip to content

Instantly share code, notes, and snippets.

@syneart
Created February 6, 2015 06:15
Show Gist options
  • Save syneart/517718c3b28c0bfb9d34 to your computer and use it in GitHub Desktop.
Save syneart/517718c3b28c0bfb9d34 to your computer and use it in GitHub Desktop.
小數值打亂程式碼片段 (Android/Java)
int MaxVal = 5; // Max
ArrayList<Integer> list=new ArrayList<Integer>();
for (int i = 1; i <= MaxVal; i++) {
list.add(i);
}
Collections.shuffle(list);
for(Integer result:list) {
Log.e("ValOut", result+""); // Result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment