Implementation of random algorithms