Question: How to do Odds vs Evens Game in Matlab, this is what I have, but I need to plot a histogram of the random values
How to do Odds vs Evens Game in Matlab, this is what I have, but I need to plot a histogram of the random values used as well as write another script that skews the data to be in favor of evens, how can I do this?
%% Odds vs Evens %% Initial Conditions oddScore -0; evenScore0; %% Game 0n for n-1:100 throw-randi([1 100], 1, 1); if rem(throw, 2) # 0 % Using rem to determine if even or odd else end evenScore-evenScore+1; oddScore - oddScore+1; end Results fprintf("Score of odds is %d ", oddScore) fprintf("Score of evens is %d ", evenScore) if evenScore > oddScore elseif evenScore oddScore elseif evenScore
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
