added random algorithm implementation and fixed bug with checkIfInterrupt