Solved

Which of the Following Statements Is False

Question 9

Multiple Choice

Which of the following statements is false?


A) Function randrange actually generates pseudorandom numbers, based on an internal calculation that begins with a numeric value known as a seed.
B) When you're debugging logic errors in programs that use randomly generated data, it can be helpful to use the same sequence of random numbers until you've eliminated the logic errors, before testing the program with other values.
C) You can use the random module's seed function to seed the random-number generator yourself-this forces randrange to begin calculating its pseudorandom number sequence from the seed you specify. Choosing the same seed will cause the random number generator to generate the same sequence of random numbers.
D) In the following session, snippets [2] and [5] produce the same results purely by coincidence: In [1]: import random
In [2]: random.seed(32)
In [3]: for roll in range(10) :
) ..: print(random.randrange(1, 7) , end=' ')
) ..:
1 2 2 3 6 2 4 1 6 1
In [4] for roll in range(10) :
) ..: print(random.randrange(1, 7) , end=' ')
) ..:
1 3 5 3 1 5 6 4 3 5
In [5] random.seed(32)
In [6]: for roll in range(10) :
) ..: print(random.randrange(1, 7) , end=' ')
) ..:
1 2 2 3 6 2 4 1 6 1

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents