I need some help creating a dice function for my homework assignment in matlab

1 view (last 30 days)
Assignment: Create a dice function (d, ant) where d is the number of sides on the cube, and ant is the number of dice to be rolled. The values ​​of the dice should returned as a vector.
I have found many examples of a single dice being rolled several time, but not for d amount of sides on a dice and x amount of dice being rolled simultaneously
Any idea how to approach the problem would be appreciated

Answers (1)

KSSV
KSSV on 15 Sep 2020
Read about randi.
d = 6 ;
ant = 5 ;
iwant = randi(d,5,1)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!