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

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

  3. Generate random number in range excluding some numbers

    Mar 24, 2017 · 37 Is there a simple way in Python to generate a random number in a range excluding some subset of numbers in that range? For example, I know that you can generate …

  4. How do I create a list of random numbers without duplicates?

    Mar 18, 2012 · I tried using random.randint(0, 100), but some numbers were the same. Is there a method/module to create a list unique random numbers?

  5. How to generate negative random value in python - Stack Overflow

    May 14, 2012 · I am starting to learn python, I tried to generate random values by passing in a negative and positive number. Let say -1, 1. How should I do this in python?

  6. python - Generate random integer without an upper bound

    Jun 9, 2015 · If rand is the random number, r : (1 - 0) :: rand : (y - x) There actually is a way to generate a random number without an upper bound, but it is not logarithmically and not …

  7. Number Guessing Game (Python) - Stack Overflow

    Nov 15, 2018 · Working in Python 3. I'm still relatively new to Python (only a few weeks worth of knowledge). The prompt that I was given for the program is to write a random number game …

  8. python - Random int without importing 'random' - Stack Overflow

    Apr 9, 2014 · There are many interesting ways to generate randomness without resorting to random (or numpy). For instance, you can use the built in hash function: def …

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

    Nov 16, 2015 · For example, I would like to generate 5 random integers coming from (1,5), (9,15),and (21,27). My code generates 5 random integers but only between 21 and 27 and not …

  10. python - How to get a random number between a float range

    May 22, 2011 · random.randrange(start, stop) only takes integer arguments. So how would I get a random number between two float values?