标签:elf pre inter class rand while define sel solution
1. rand7生成rand10
1 # The rand7() API is already defined for you. 2 # def rand7(): 3 # @return a random integer in the range 1 to 7 4 5 class Solution(object): 6 def rand10(self): 7 n=7*(rand7()-1)+(rand7()-1) 8 while(n>39): 9 return self.rand10() 10 11 return n%10+1
标签:elf pre inter class rand while define sel solution
原文地址:https://www.cnblogs.com/zijidan/p/12501805.html