java - How to randomly pick an element from an array -


i looking solution pick number randomly integer array.

for example have array new int[]{1,2,3}, how can pick number randomly?

public static int getrandom(int[] array) {     int rnd = new random().nextint(array.length);     return array[rnd]; } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -