samedi 16 novembre 2019

How to set the seed value in python to a specific number for my rancom number generator

import statistics as stat
from statistics import mean
from random import seed, choice
from math import hypot
import random
from turtle import *


seed(20190101)

for i in range(100):
    i = random.randint(1,1000)
    random.seed(20190101)
    print(i)

please ignore the unused modules for now!

So i am beginning to write my program and I have a seed value that I am trying to set. I need to get 100 numbers that are completely random from a certain seed value. So i wrote a for loop with the seed value inside of it, and the random integer. But I just get a random number for 100 times over. Any thoughts?




Aucun commentaire:

Enregistrer un commentaire