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

    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 …

  2. python - How to generate a random number with a specific …

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

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

    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 …

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

    Nov 16, 2015 · 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 …

  5. 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 …

  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. ¿Uso de random.randint () en python para un rango inespecífico o ...

    Jun 28, 2023 · Estoy trabajando con el modulo random.randint para crear una lista de n números enteros. La sintaxis me obliga a introducir un número mínimo y uno máximo para el rango de …

  8. 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 …

  9. 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.

  10. python - Generate random colors (RGB) - Stack Overflow

    Mar 12, 2015 · I just picked up image processing in python this past week at the suggestion of a friend to generate patterns of random colors. I found this piece of script online that generates a …