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

    105 from random import randint x = [randint(0, 9) for p in range(0, 10)] This generates 10 pseudorandom integers in range 0 to 9 inclusive.

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

    From this internal state, output for randint (1,10) and other calls are derived. If the RNG was feeding from the output of randint (1,10) the sequence would collapse to 1 of at most 10 …

  3. 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: from random import randint, randrange randint(100, 999) # randint is inclusive …

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

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

    Apr 2, 2010 · 16 I guess random.randint was just the first attempt at implementing this feature. It seems that the Python developers also felt that this was a problem, which is why in v1.5.2 they …

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

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

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

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

  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 …