random functions and algorithms