forked from IF-LK-2020/array
generateIntArray
This commit is contained in:
12
Arrays.java
12
Arrays.java
@@ -39,7 +39,17 @@ public class Arrays {
|
||||
* @see #getRandomInt(int, int)
|
||||
*/
|
||||
public int[] generateIntArray( int pNumberOfElements, int pMin, int pMax ) {
|
||||
return null;
|
||||
|
||||
if (pNumberOfElements < 0) {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
int[] arr = new int[pNumberOfElements];
|
||||
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
arr[i] = getRandomInt(pMin, pMax);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user