Post Reply 
Dice roll results
05-24-2020, 09:15 PM (This post was last modified: 05-24-2020 09:17 PM by ijabbott.)
Post: #3
RE: Dice roll results
You should be able to do it with a couple of loops:

EXPORT TossDice(toss,sides)
BEGIN
LOCAL i,j,f,p,r;
f := sides^toss;
MAKEMAT(f,toss)▶r;

FOR i FROM 1 to f DO
p := i-1;
FOR j FROM 1 to toss DO
r[i,j] := 1 + p MOD sides;
p := IP(p / sides);
END;
END;
END;

I haven't tested it.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Dice roll results - Tonig00 - 05-24-2020, 04:05 PM
RE: Dice roll results - victorvbc - 05-24-2020, 06:02 PM
RE: Dice roll results - ijabbott - 05-24-2020 09:15 PM
RE: Dice roll results - Carlos295pz - 05-24-2020, 11:28 PM
RE: Dice roll results - Tonig00 - 05-25-2020, 06:28 PM
RE: Dice roll results - pinkman - 05-25-2020, 10:04 PM
RE: Dice roll results - pinkman - 05-25-2020, 10:08 PM
RE: Dice roll results - Tonig00 - 05-26-2020, 11:05 PM
RE: Dice roll results - lmmt61 - 05-28-2020, 07:03 AM
RE: Dice roll results - Tonig00 - 05-30-2020, 03:31 PM



User(s) browsing this thread: 2 Guest(s)