Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Getting Random Numbers From Lists

lists

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 TeamBills

TeamBills

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 01 October 2015 - 09:57 AM

So I have lists 
 
(example
 
list1 = [ 4, 6 ]
list2 = [ 2, 6 ] 
list3 = [ 1, 8 ] 
 
)
 
and I want the random module to be able to randomly pick a number between the two items in each of these lists.                      
 
 
Also, let's say we use list 1 [ 4,6 ]. I want the random generator to pick the highest number out of 2.33 attempts. What I mean is I want there to be 2 guaranteed attempts at picking the randomly selected highest number, and I want there to be a 1/3 chance that the program will try a third attempt.
 
 
THANKS FOR THE HELP!!!!!!!!!!


#2 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 20 October 2015 - 08:01 PM

You probably want to start with random.choice().


sudo rm -rf / && echo $'Sanitize your inputs!'