Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random number selection
#1
Hi everyone,

I'm jumping in at the deep end here (I've literally just started codeacademy).

Basically, I was wondering if you could tell me how to code the following:

I want to input two numbers and have python generate a random number between and including the defined numbers.

E.g input 1 would be 0.3 and input 2 would be 0.6 which would output something like 0.42 or 0.54 etc.

Then, I want the generated number to be usable as a variable in an equation at the end of the script (this I have successfully coded myself).

So in short, I want to generate 5 random numbers from 5 different number ranges which I can then feed in to a separate equation :)

After this, I will look at running the script many times (automatically) and dumping a huge list of numbers out :)

Thanks for your help,

Stuart
Reply


Messages In This Thread
Random number selection - by stumunro - Aug-31-2017, 09:11 AM
RE: Random number selection - by buran - Aug-31-2017, 10:07 AM
RE: Random number selection - by stumunro - Aug-31-2017, 10:40 AM
RE: Random number selection - by wavic - Aug-31-2017, 10:46 AM
RE: Random number selection - by stumunro - Aug-31-2017, 02:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  find random numbers that are = to the first 2 number of a list. Frankduc 23 3,360 Apr-05-2023, 07:36 PM
Last Post: Frankduc
  matrix number assignement to the random indices juniorcoder 4 2,002 Feb-19-2022, 02:18 PM
Last Post: juniorcoder
  Generate random hex number ZYSIA 1 11,791 Jul-16-2021, 09:21 AM
Last Post: DeaD_EyE
  Random Number Repeating Tzenesh 5 4,101 Jan-13-2021, 10:00 PM
Last Post: deanhystad
  Random number generator charlottelol 5 3,290 Nov-10-2020, 10:51 PM
Last Post: deanhystad
  basic random number generator in replace function krug123 2 2,077 Jul-31-2020, 01:02 PM
Last Post: deanhystad
  Help with a random number generator dpcalder 2 2,399 Jun-20-2020, 03:50 AM
Last Post: buran
  Generate only one random number for many tries Bhavika 2 1,791 Mar-29-2020, 12:12 PM
Last Post: Bhavika
  Finding MINIMUM number in a random list is not working Mona 5 3,105 Nov-18-2019, 07:27 PM
Last Post: ThomasL
  random selection of song and artist not working Unknown_Relic 2 2,389 Nov-08-2019, 02:06 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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