Remove the dependency on random