About 1,290,000 results
Open links in new tab
  1. python - Generate random integers between 0 and 9 - Stack Overflow

    If you're restricted to the standard library, and you want to generate a lot of random integers, then random.choices() is much faster than random.randint() or random.randrange(). 2 For example to …

  2. python - What is the difference between random.randint and …

    The reason is historical: randint was added early in v1.5 circa 1998 and this function name was used for generating both random floating-point numbers randomly and integers randomly randrange was …

  3. python - How to generate a random number with a specific amount of ...

    Jul 4, 2021 · 278 You can use either of random.randint or random.randrange. So to get a random 3-digit number:

  4. Python: why does `random.randint (a, b)` return a range inclusive of `b ...

    Apr 2, 2010 · I suspected that randint was implemented before Python's long integer: meaning that if you wanted a random number that included INT_MAX, you would have needed to call …

  5. python - How to generate random integers with multiple ranges?

    Nov 16, 2015 · 0 for i in (randint(1,5),randint(9,15),randint(21,27)): print i This foor loop will generate 3 random numbers one from the first range supplied, another for second range and last one for last …

  6. What does `random.seed()` do in Python? - Stack Overflow

    234 I am a bit confused on what random.seed() does in Python. For example, why does the below trials do what they do (consistently)?

  7. Generate 'n' unique random numbers within a range [duplicate]

    Apr 3, 2014 · I know how to generate a random number within a range in Python. random.randint(numLow, numHigh) And I know I can put this in a loop to generate n amount of these …

  8. How do i get 10 random values in python? - Stack Overflow

    Sep 8, 2014 · I can simply generate random numbers using random function "randint" but could not generate set of random numbers. For instance i want to get 10 random numbers.

  9. Generate a random letter in Python - Stack Overflow

    Is there a way to generate random letters in Python (like random.randint but for letters)? The range functionality of random.randint would be nice but having a generator that just outputs a random ...

  10. Python random numbers multiple times - Stack Overflow

    rnumber = random.randint(number1, number2) print (rnumber) main() I am messing around in Python, and I want my program to generate random numbers. As you can see I have already accomplished …