MCPcopy Create free account
hub / github.com/DiUS/java-faker / nextElement

Method nextElement

src/main/java/com/github/javafaker/Options.java:41–43  ·  view source on GitHub ↗

Returns a random element from an array. @param array The array to take a random element from. @param The type of the elements in the array. @return A randomly selected element from the array.

(E[] array)

Source from the content-addressed store, hash-verified

39 * @return A randomly selected element from the array.
40 */
41 public <E> E nextElement(E[] array) {
42 return array[faker.random().nextInt(array.length)];
43 }
44
45 /**
46 * Returns a random element from a list.

Callers 2

testNextArrayElementMethod · 0.80
testNextListElementMethod · 0.80

Calls 4

nextIntMethod · 0.80
getMethod · 0.65
randomMethod · 0.45
sizeMethod · 0.45

Tested by 2

testNextArrayElementMethod · 0.64
testNextListElementMethod · 0.64