I have written a program that generates a random integer from a large range and puts that number into another part of the function. It worked very well before but suddenly stopped. The program itself finally works the way it should be instead of generating random data it just repeats the same one over and over.
Since randomness is my goal I played with random.random and random.choice but I had the same result.
@app.route('/button', methods=['POST', 'GET'])
def roulette():
f = open("GutProject.txt", "w")
for x in range(1):
y = (random.choice(0, 59000))
text = strip_headers(load_etext(y)).strip()
f.write(text)
return send_file('GutProject.txt',
mimetype='text/plain',
attachment_filename='GutProject.txt',
as_attachment=True)
I would like to generate a randomly created txt file based on the integer chosen. It has worked in the past with the same python function so I can't figure out why it's not working now.
Aucun commentaire:
Enregistrer un commentaire