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

    Oct 22, 2010 · 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

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

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

  3. How exactly does random.random () work in python?

    Feb 2, 2017 · The random module in python contains two interfaces (classes) of pseudorandom number generators (PRNGs). You can view it as two ways to generate random numbers.

  4. python - How can I randomly select (choose) an item from a list …

    Nov 20, 2008 · 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:

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

  6. python - How do I Assign a random number to a variable? - Stack …

    Mar 19, 2014 · I've tried mucking around with things like Str = random.randomint(1,18), using the random module. The closest I've come is using the lambda function, so that when I call up the variable it generates a random number which is different each time. None of these have rally worked, and I would really like to know what I'm doing wrong.

  7. random iteration in Python - Stack Overflow

    Feb 12, 2012 · Also, Python automatically seeds its random number generator so a call to random.seed() is not required.

  8. Python: Random numbers into a list - Stack Overflow

    Computers programs in Python always do one thing at a time. Every program is a sequence of very tiny steps. Now, the question then becomes "What steps do I want completed when I print the list?". And you, apparently, want all the random …

  9. python - Randomly generate 1 or -1 (positive or negative integer ...

    Oct 19, 2017 · I wanted to generate 1 or -1 in Python as a step to randomizing between non-negative and non-positive numbers or to randomly changing sign of an already existing integer. What would be the best way...

  10. Number Guessing Game (Python) - Stack Overflow

    Oct 29, 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 where the user has to guess the random number (between 1 and 100) and is given hints of being either too low or too high if incorrect.