Python Forum
random module in while loops
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random module in while loops
#3
(Feb-03-2017, 11:33 AM)Larz60+ Wrote: You need to set a seed. See https://docs.python.org/3.6/library/random.html

the syntax is
random.seed()

That really shouldn't be the issue.  The random module is seeded initially regardless (with a call to the systems clock I believe).  Subsequent calls to random.randint shouldn't give the same value because of this.  Providing your own seed is generally only needed if you want to be able to have deterministic behavior.  

I think the issue here is simply typos:
       u1move = u1step + u1jump
       u1step = u1move
       u2move = u2step + u1jump
       u2step = u2move
       u3move = u3step + u1jump
       u3step = u3move
I'm guessing those u1jump's should be u2jump and u3jump for u2move and u3move respectively.
Reply


Messages In This Thread
random module in while loops - by yuvalsaias - Feb-03-2017, 11:25 AM
RE: random module in while loops - by Larz60+ - Feb-03-2017, 11:33 AM
RE: random module in while loops - by Mekire - Feb-03-2017, 12:15 PM
RE: random module in while loops - by wavic - Feb-03-2017, 12:17 PM
RE: random module in while loops - by Mekire - Feb-03-2017, 12:21 PM
RE: random module in while loops - by wavic - Feb-03-2017, 01:50 PM
RE: random module in while loops - by yuvalsaias - Feb-03-2017, 12:41 PM
RE: random module in while loops - by snippsat - Feb-03-2017, 02:13 PM
RE: random module in while loops - by wavic - Feb-03-2017, 03:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  <while> cycle is not interrupted when using the <random>module ShityCoder 3 2,249 Sep-04-2020, 04:05 PM
Last Post: ShityCoder
  Some help with Classes and the random module please? :) AlluminumFoil 2 2,248 Jan-08-2020, 11:03 PM
Last Post: AlluminumFoil
  Can't Get Random Module! Pls Help! VictorVictus 1 7,258 Aug-24-2019, 10:20 AM
Last Post: snippsat
  Question about the Random Module Exsul 1 2,030 Mar-13-2019, 02:06 AM
Last Post: ichabod801
  Random module Python 3.6 daryl_uk 1 2,313 Oct-25-2018, 12:09 AM
Last Post: micseydel
  Random module works in idle but not terminal. ottowiser 3 5,600 Apr-11-2018, 10:59 PM
Last Post: ottowiser

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020