random algorithm completed