Randomize numbers within a subset

Posted by Samuel on Stack Overflow See other posts from Stack Overflow or by Samuel
Published on 2010-03-22T13:09:21Z Indexed on 2010/03/22 13:11 UTC
Read the original article Hit count: 226

Filed under:
|

I have a array of integer numbers (say 1,2,3,4,5 or 1,2,3, ... 10 or 1,2,3, ... 50) from which I would like to get a random set of numbers ordered differently every time. Is there a utility method to do this?

e.g. for 1,2,3,4,5 post randomization it might be either [1,5,4,2,3 or 2,1,3,5,4 or 3,1,2,4,5 or ...]

I would like to know if there is a java utility method / class which already provides this capability?

© Stack Overflow or respective owner

Related posts about java

Related posts about random