Problems involving randomness Optimality conditions mathematics