题目内容

2. If you were going to use random.seed in a real-life simulation instead of just when you are debugging a simulation, would you want to seed it with 0?

A. Yes
B. No

查看答案
更多问题

If so, what line would you modify to compensate? Enter the line number (eg 17). If not, just type None.1. def simWalks(numSteps, numTrials): 2. homer = Drunk('Homer') 3. notOrigin = Location(1, 0) 4. distances = [] 5. for t in range(numTrials): 6. f = Field() 7. f.addDrunk(homer, notOrigin) 8. distances.append(walk(f, homer, numTrials)) 9. return distances______

Canopy Users: If you have code that calls a random function and then calls random.seed(0) or some other integer other than 0, subsequent times you run your program with the green run arrow button, the random function before you called random.seed(0) will now be seeded as well. To completely reset between runs, you will have to restart the kernel via the menu option (Run -> Restart Kernel) or via the keyboard (Ctrl with the period key).Additionally, if you are writing a program and would like to generate pseudorandom number later on in the code, you can reset the seed to use the system clock with random.seed() (without any arguments).1. Would placing the drunk's starting location not at the origin change the distances returned?

A. Yes
B. No

Are the following two distributions equivalent?import random def dist5(): return int(random.random() * 10) def dist6(): return random.randint(0, 10)

A. Yes
B. No

Are the following two distributions equivalent?import random def dist3(): return int(random.random() * 10) def dist4(): return random.randrange(0, 10)

A. Yes
B. No

答案查题题库