package AbsenceSchedules;

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

public class AbsencesVector {
    private int[] AbsencesVector;
    private double probAbsence = 0.02;
    private double probReturn = 0.80;

    public AbsencesVector(int length, RandomEngine r) {

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

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