forked from Hithomelabs/Princeton1
Reviewed-on: Hithomelabs/Princeton1#17 Reviewed-by: kruti <krutis0201@gmail.com> Co-authored-by: hitanshu310 <hitanshu98@gmail.com> Co-committed-by: hitanshu310 <hitanshu98@gmail.com>
31 lines
691 B
Java
31 lines
691 B
Java
package com.hithomelabs.clients.Benchmarks.Sortables;
|
|
|
|
import com.hithomelabs.clients.Benchmarks.Sortable;
|
|
import com.hithomelabs.princeton1.common.Apple;
|
|
|
|
import java.util.Random;
|
|
|
|
public class RandomlySizedApples implements Sortable<Apple> {
|
|
|
|
Apple[] apples;
|
|
Random random;
|
|
|
|
public RandomlySizedApples(int size, int sizeRange){
|
|
random = new Random();
|
|
apples = new Apple[size];
|
|
for (int i = 0; i < size; i++)
|
|
apples[i] = new Apple(random.nextInt(sizeRange));
|
|
}
|
|
|
|
|
|
@Override
|
|
public Apple[] getArray() {
|
|
return apples.clone();
|
|
}
|
|
|
|
@Override
|
|
public String getOrdering() {
|
|
return "RANDOMLY ORDERED";
|
|
}
|
|
}
|