174k views
3 votes
Which of the following expressions will produce a valid random integer between the int values m and n inclusive, where m < n?

User Steve Ives
by
4.8k points

1 Answer

3 votes

Answer:

The solution code is written in Python:

m = 1

n = 5

d = random.randint(m, n)

Step-by-step explanation:

To get a random integer between m and n inclusive, we can make use of Python randint method. It will take two parameters, m and n. By giving two integers as an input (e.g. 1 and 5) to randint, it will generate a random integer between 1 to 5 inclusive.

User Clemahieu
by
4.1k points