function prioritet=prior_gen(E,p1,p2,p3,p4,p5,p6)
a=2;
m=24+p1*10+p2*10+p3*10+p4*10+p5*10+p6*10;

temp=mod((E*a),m);

granica1=0;
granica2=granica1 + 4+p1*10;
granica3=granica2 + 4+p2*10;
granica4=granica3 + 4+p3*10;
granica5=granica4 + 4+p4*10;
granica6=granica5 + 4+p5*10;
granica7=granica6 + 4+p6*10;


if (temp >= granica1 & temp <= granica2)
    temp=1;
end;
if (temp > granica2 & temp <= granica3)
    temp=2;
end;
if ( temp > granica3 & temp <= granica4)
    temp=3;
end;
if (temp > granica4 & temp <= granica5)
    temp=4;
end;
if (temp > granica5 & temp <= granica6)
    temp=5;
end;
if (temp > granica6 & temp <= granica7)
    temp=6;
end;
prioritet= temp;
