Python - drawing randomly n numbers integer from range -


I think that when I use getn , I want to get the same effect , But it should be an integer number from the interval to [1 ... 100]

  Import Rendin Randint From Random (1, 100) # = & gt; 86  

If you want a bunch of numbers,

  def getn_rand (n): randint (1, 100) _ for category (n )]  

or if the number should be different (no duplicate),

  random import sample def get_rand_distinct (n) from: Return sample (range ( 1, 101), n)  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -