apply random generation