Created
July 21, 2018 06:06
-
-
Save Manikant92/5efd642a5ca9a58dc2eb6c77e2c6535f 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 | |
random.seed(3) | |
#a with random seed number | |
a = [random.randint(1, 100) for i in range(10)] | |
print(a) | |
#output-1 when run first time: [61, 35, 85, 68, 86, 45, 19, 49, 2, 48] | |
#output-2 when run second time: [61, 35, 85, 68, 86, 45, 19, 49, 2, 48] | |
#b without random seed number | |
b = [random.randint(1, 100) for j in range(10)] | |
print(b) | |
#output-1 when run first time: [80, 19, 57, 48, 21, 44, 27, 8, 74, 26] | |
#output-2 when run second time: [10, 66, 88, 44, 88, 52, 12, 3, 8, 85] | |
random.seed(1) | |
a = [random.randint(1, 100) for j in range(10)] | |
#output-1: [18, 73, 98, 9, 33, 16, 64, 98, 58, 61] | |
#output-2: [18, 73, 98, 9, 33, 16, 64, 98, 58, 61] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment