Created
March 24, 2018 15:30
-
-
Save songouyang/9920cd785fd1c9dcefcac64288ff64cd to your computer and use it in GitHub Desktop.
等概率抽样
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def get_ran(m, n): | |
| for i in range(n): | |
| if(random.randint(0, n-i-1) < m): | |
| print(i, end="") | |
| m -= 1 | |
| print() | |
| if __name__ == "__main__": | |
| for _ in range(200): | |
| get_ran(2, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment