Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- '''
- in the format: random.choice(a, size = size, replace = True/False)
- a is a list or other object that has values we are sampling from
- size is a number that represents how many values to choose
- replace determines whether we keep a value in a after drawing it (True) or remove it from the pool (False)
- '''
- # create 6 sided "die"
- die_6 = range(1, 7)
- # set number of rolls
- num_rolls = 10
- # roll the "die" the set amount of times
- results_1 = np.random.choice(die_6, size = num_rolls, replace = True)
- print(results_1)
Add Comment
Please, Sign In to add comment