Java Random randomValue(T[] array)

Here you can find the source of randomValue(T[] array)

Description

random Value

License

Open Source License

Declaration

public static <T> T randomValue(T[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <T> T randomValue(T[] array) {
        int index = (int) (Math.random() * array.length);
        return array[index];
    }/*from ww  w .ja  v a2s .co  m*/
}

Related

  1. randomStr(Random rnd, int size)
  2. randomSubList(List list, int sizeOfSubList)
  3. randomSuccess()
  4. randomUniformUniqueIntegerList(int sz)
  5. randomValue()
  6. randomVector(int size)
  7. randRandom(Random random)
  8. randRange(float from, float to)
  9. randRangeDecimal(float min, float max)