Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
https://repl.it/C93N/0 created by charles2588
import random
def rand5():
return random.randrange(0,6,1)
def rand7():
diff=7-5
x=rand5()
if x<=rand5():
return x
else:
return x+diff
#arr=range(0,6)
#count=0
for i in range(50):
# if count>7:
# break
# if rand7() in arr:count+=1
print(rand7())
Python 3.5.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
>>> 4
6
0
2
5
6
1
1
7
4
7
0
5
2
1
4
1
2
1
6
2
0
0
0
4
0
2
7
1
4
6
6
1
4
2
3
0
7
4
7
6
5
4
0
3
2
2
6
5
1
=> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.