annasophie

10 Reputation

3 Badges

6 years, 266 days

MaplePrimes Activity


These are questions asked by annasophie

Hi everyone,

I just started using Maple which is part of a class I am taking. 

We are asked to write a procedure which returns two random values (think two dice).

What I would like to do is:

dice := proc()
    local a,b;
    a := rand(1..6);
    b := rand(1..6);
    
    return a,b;
end proc:

That doesn't work and I don't understand why. How does rand work? Also, how can I call rand in a loop, i.e. repeat rand n times and add the values?

I really hope you can help me here, really struggling.

Page 1 of 1