How to set a random seed for prn generation?

0 votes
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?
Feb 4 in Python by ariaholic
• 7,340 points
17 views

1 answer to this question.

0 votes
The main python module that is run should import random and call random.seed(n) - this is shared between all other imports of random as long as somewhere else doesn't reset the seed.
answered Feb 4 by charlie_brown
• 7,720 points

Related Questions In Python

0 votes
1 answer

In python how to test a string for a substring

if "ABCD" in "xxxxABCDyyyy": This can be used ...READ MORE

answered Oct 24, 2018 in Python by Priyaj
• 56,520 points
64 views
0 votes
1 answer

how to check for exceptions in a file?

try { if (!file.exists("TextFile1.txt")) throw ...READ MORE

answered Mar 20 in Python by Mohammad
• 3,060 points
15 views
0 votes
1 answer
0 votes
1 answer

How to search for a word in a string in Python?

You can do it like this: txt = ...READ MORE

answered Apr 4 in Python by Kumar
27 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 220 views
+4 votes
6 answers
+2 votes
2 answers

How to make a laplacian pyramid using OpenCV python?

down voteacceptTheeThe problem is that you're iterating ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,720 points
1,279 views
+2 votes
2 answers

How to use BeatifulSoup for webscraping?

your programme is fine until you start ...READ MORE

answered Apr 4, 2018 in Python by charlie_brown
• 7,720 points
42 views