This question already has an answer here:
- Randomize a List<T> 20 answers
Please consider these numbers:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
I want an efficient algorithm that randomly select one of above numbers and put them Continuous.For example:
8, 2, 1, 10, 4, 3, 5, 9, 7, 6
or
1, 9, 3, 10, 6, 5, 8, 7, 2, 4
Is there any algorithm with O(n)?
Thanks
Aucun commentaire:
Enregistrer un commentaire