About 21,000,000 results
Open links in new tab
  1. python - How can I randomly select (choose) an item from a list …

    As of Python 3.6 you can use the secrets module, which is preferable to the random module for cryptography or security uses. To print a random element from a list:

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

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

    random.seed(a, version) in python is used to initialize the pseudo-random number generator (PRNG). PRNG is algorithm that generates sequence of numbers approximating the …

  4. How to generate random strings in Python? - Stack Overflow

    Mar 17, 2022 · How do you create a random string in Python? I need it to be number then character, repeating until the iteration is done. This is what I created: def random_id(length): …

  5. set random seed programwide in python - Stack Overflow

    Jul 17, 2012 · Absolutely true, If somewhere in your application you are using random numbers from the random module, lets say function random.choices() and then further down at some …

  6. Whats the difference between os.urandom() and random?

    Nov 27, 2017 · 28 On the random module python page (Link Here) there is this warning: Warning: The pseudo-random generators of this module should not be used for security purposes. Use …

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

    random.randint(4, 8) # picks a random number from 4, 5, 6, 7, 8 # it does indeed include 8! The reason is historical: randint was added early in v1.5 circa 1998 and this function name was …

  8. python - Random string generation with upper case letters and …

    How do I generate a string of size N, made of numbers and uppercase English letters such as: 6U1S75 4Z4UKK U911K4

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

  10. python - random.choice from set? - Stack Overflow

    On my machine, random.sample goes from being slower than random.choice to being faster than it as the set size grows (the crossover point is somewhere between set size 100k-500k).