Design of random experiments in Python