| dice | R Documentation | 
dice generates a sequence of events that 
represent the results of throwing a fair dice 
(with a given number of events or number of sides) 
n times.
dice(n = 1, events = 1:6)
n | 
 Number of dice throws. 
Default:   | 
events | 
 Events to draw from (or number of sides).
Default:   | 
By default, the 6 possible events for each throw of the dice  
are the numbers from 1 to 6.
Other sampling functions: 
coin(),
dice_2(),
sample_char(),
sample_date(),
sample_time()
# Basics:
dice()
table(dice(10^4))
# 5-sided dice:
dice(events = 1:5)
table(dice(100, events = 5))
# Strange dice:
dice(5, events = 8:9)
table(dice(100, LETTERS[1:3]))
# Note:
dice(10, 1)
table(dice(100, 2))
# Note an oddity:
dice(10, events = 8:9)  # works as expected, but 
dice(10, events = 9:9)  # odd: see sample() for an explanation.
# Limits:
dice(NA)
dice(0)
dice(1/2)
dice(2:3)
dice(5, events = NA)
dice(5, events = 1/2)
dice(NULL, NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.