How do I simulate biased die in python?
问题 I want to simulate N-sided biased die? def roll(N,bias): '''this function rolls N dimensional die with biasing provided''' # do something return result >> N=6 >> bias=( 0.20,0.20,0.15,0.15,0.14,0.16,) >> roll(N,bias) 2 回答1: A little bit of math here. A regular die will give each number 1-6 with equal probability, namely 1/6 . This is referred to as uniform distribution (the discrete version of it, as opposed to the continuous version). Meaning that if X is a random variable describing the