How can I generate list of random odd numbers from 1 to 99 (including) in python

SSP

I am using the following code:-

my_list = range(1,99) 
list_Odd_Numbers = list(filter(lambda varX: varX % 2 == 1,my_list)) 
print(list_Odd_Numbers)

I want random and infinite loop

Andrej Kesely
from random import randint

random_odd_numbers = (val for val in iter(lambda: randint(1, 99), 0) if val % 2 != 0)

for number in random_odd_numbers:
    print(number)

Prints:

...
99
81
57
85
87
95
49
...and so on.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I generate an array of random numbers that fluctuate by 1 in javascript?

How do I generate a random list in Python with duplicates numbers

Generate Random numbers from tuple list in Python

How can I generate a random sequence of elements from a list in Haskell?

Generate random numbers from a distribution given by a list of numbers in python

Python odd numbers from list

How can I generate random numbers between -1 and 1 using rand_r

How can I write a function that returns odd numbers only from a list of integers, using R language?

How can I generate a list of consecutive numbers?

How can I generate a list of consecutive numbers?

MATLAB: how can I generate 2 random numbers which sum is less than 1?

Generate random numbers from a list of numbers

How to make a list of N consecutive odd numbers starting from 1

I am generating random numbers from 1~10, but I want to give number 8 high priority, so that 8 number should generate more times, how can I do this?

how to generate 50 random numbers between 10 and 99, no duplicates.

How to generate random numbers from a list, without repeating the last one?

How can I generate n random numbers without a for loop

How can I generate a range of random floating point numbers in Julia?

How can I generate a random sequence of numbers in JavaScript with conditions?

How to generate list of random numbers in Python with some None values?

How to generate a list of random numbers with many zero values in Python?

how to generate random numbers from 1 to 4 and 8 in swift

How i can get random object from list in Python

Generate random list of numbers that add up to 1

How do I generate random but unique numbers in python?

How to generate random numbers from the given numbers

How to generate random numbers fast from "An Extremely Big Array" in Python?

How do I format an array with 1000 random numbers from 10-99?

How to generate random numbers without including a set number?