Java Random randomElementFromArray(T[] source)

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

Description

random Element From Array

License

Open Source License

Declaration

public static <T> T randomElementFromArray(T[] source) 

Method Source Code

//package com.java2s;

public class Main {
    public static <T> T randomElementFromArray(T[] source) {
        return source[(int) (Math.random() * source.length)];
    }//from  w  ww .  j  a  va  2s . co m
}

Related

  1. randomData(Random random, int length)
  2. randomDigit()
  3. randomDoubleArray(int size)
  4. randomElement(List list, Random random)
  5. randomElement(T[] items)
  6. randomEntre1eh100()
  7. randomEnum(Class clazz)
  8. randomEvent(float theChance, float theRange)
  9. randomException()