# Python3
# rand() will return number from [0, R) with the same posibility
# assume R > N > 0
def getNum(N):
num = rand()
while num > N:
num = rand()
return num
# How many times the while-loop may executed?
若要以 R 跟 N 表示 time complexity
想請問這題有什麼方法可以下手嗎?
感謝各位大神們 :)