package AbsenceSchedules;

import jdistlib.Binomial;
import jdistlib.rng.RandomEngine;

public class AbsencesVector {
    private boolean[] AbsencesVector;

    public AbsencesVector(int length, RandomEngine r) {

        int current = 1;
        AbsencesVector = new boolean[length];
        Binomial b1 = new Binomial(1, ParametersAbsencesSimulator.probPresence);
        b1.setRandomEngine(r);
        Binomial b2 = new Binomial(1, ParametersAbsencesSimulator.probReturn);
        b2.setRandomEngine(r);
        for (int i = 0; i < length; i++) {
            if (current == 1) {
                current = (int) b1.random();
                AbsencesVector[i] = current == 1;
            } else {
                current = (int) b2.random();
                AbsencesVector[i] = current == 1;
            }
        }
    }

    public boolean[] getAbsencesVector() {
        return AbsencesVector;
    }
}
