About 88,500 results
Open links in new tab
  1. 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 …

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

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

  4. python - What is the difference between FROM random IMPORT

    Now, when you're accessing random, you're accessing the function instead of the module. You could use randrange (without the prefix random.), but import random and explicitly stating what …

  5. Random word generator- Python - Stack Overflow

    Using random.sample will provide you with a list of the total number of items (characters in this case) from the given object (a string object here) based on the number you want …

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

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

  8. Generate random integers between 0 and 9 - Stack Overflow

    How can I generate random integers between 0 and 9 (inclusive) in Python? For example, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

  9. Generate password in Python - Stack Overflow

    Oct 4, 2010 · I'd like to generate some alphanumeric passwords in Python. Some possible ways are: import string from random import sample, choice chars = string.ascii_letters + string.digits …

  10. python - How can I get a random key-value pair from a dictionary ...

    Check out random.sample() which will select and return a random element from an list. You can get a list of dictionary keys with dict.keys() and a list of dictionary values with dict.values().