# How to generate a random list of ints in Python3?

## Question:

My idea is as follows:

```
l=[]
for i in range(10):
l.append(random.randint(0,100))
```

But is there a more convenient way to generate a random list of ints since I’ve imported the random module?

## Answers:

```
my_list = [random.randint(0,100) for r in range(10)]
```

Not sure what is most “convenient”, but `random.choices`

returns a list of specified length from a given population.

```
random.choices(range(100), k=10)
```