Rolling dice multiple times?

12 ビュー (過去 30 日間)
Brian Tiffman
Brian Tiffman 2016 年 1 月 22 日
回答済み: Walter Roberson 2016 年 1 月 22 日
I want to have my code to roll five dice once, which I will do using the randi command. I then want to reroll certain dice two more times. For example, after the first roll maybe I want to keep dice 2 and 4, but I want to reroll the rest. Can someone give me some insight into how I would do this. I just want some guidance toward this. Your help is appreciated. Thanks.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 1 月 22 日
Hint:
rolled(columns_to_discard) = new_random_values;

カテゴリ

Help Center および File ExchangeWord games についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by