import java.util.Random;
public class Main {
static void FillArrayWithRandom1and0(int[] array) {
Random rand = new Random();
int len = array.length;
for (int i = 0; i < len; i++) {
array[i] = rand.nextInt(2); // Generates either 0 or 1
}
}
public static void main(String[] args) {
int size = 10; // You can change the size of the array
int[] array = new int[size];
FillArrayWithRandom1and0(array);
for (int num : array) {
System.out.print(num + " ");
}
}
}
/*
run:
0 0 1 1 1 0 1 0 0 1
*/