Skip to content
Snippets Groups Projects
Commit 5b3664e2 authored by dragapsy's avatar dragapsy
Browse files

Tache 4 (La methode randomElement(List<T> elements, Random random)).

parent 84f5f2e8
No related branches found
No related tags found
No related merge requests found
package util;
import java.util.List;
import java.util.Random;
public class RandomUtil {
......@@ -11,7 +12,11 @@ public class RandomUtil {
return element;
}
public static <T> T randomElement(List<T> elements, Random random){
T element= elements.get(random.nextInt(elements.size()));
return element;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment