added random algorithm and the means to support it