Learning random generation