fork
repeat(10)begin
begin
num = $urandom_range(1,100);
mbx.put(num);
if(num % 2==!0)begin
q.push_back(num);
if(q.size()>5)
break;
end
end
begin
mbx.get(num);
q1.push_back(num);
end
end
join_any
disable fork
In the above code my aim is → a set of 10 numbers generated, if there are more than 5 odd numbers display an error. restart the thread and continue this checking for every groups of 10 numbers.
As per the above code my loop is breaking as soon as mode than 5 odd numbers are generating,however I am confused how to restart the process again and how to check for 10 number groups each time?
Please help me in this.
Thanks