About 53 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 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:

  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 exactly does random.random() work in python? - Stack …

    Feb 2, 2017 · The random () method is implemented in C, executes in a single Python step, and is, therefore, threadsafe. The _random is a compiled C library that contains few basic …

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

  6. Como gerar números aleatórios em Python?

    Jul 24, 2015 · Para gerar números aleatórios em Python 3, você pode usar a biblioteca " random ". Aqui está um exemplo para gerar um número inteiro aleatório entre 0 e 9:

  7. python - How do I create a list of random numbers without …

    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?

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

  9. What does the random.sample () method in Python do?

    Mar 30, 2014 · I want to know the use of random.sample() method and what does it give? When should it be used and some example usage.

  10. Python random function - Stack Overflow

    Feb 21, 2013 · The 'random' module is a package from the python standard library, as well as a function defined in this package. Using 'import random' imports the package, which you can …