Cody

Solution 1028787

Submitted on 23 Oct 2016 by Peng Liu
  • Size: 19
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 1:3; prob = [0.3 0.2 0.5]; assert( (sum(RandomRoulette(x,prob))<1.5*22*1e3) && (sum(RandomRoulette(x,prob))>0.5*22*1e3) && all(ismember(RandomRoulette(x,prob),x)) )

2   Pass
x = 1:4 prob = [0.1 0.2 0.3 0.4]; assert( (sum(RandomRoulette(x,prob))<1.5*30*1e3) && (sum(RandomRoulette(x,prob))>0.5*30*1e3) && all(ismember(RandomRoulette(x,prob),x)) && any(RandomRoulette(x,prob)~=RandomRoulette(x,prob)))

x = 1 2 3 4

Suggested Problems

More from this Author10