ExquisiteCorpse, Random.Next() question

Hi I hope you are having a nice day. I am working on the C# ExquisiteCorpse program.

My question is with the Random.Next() Method, in the ExquisiteCorpse program.

In the parameters of the Random.Next(min, max)

We have set -

int head = Random.Next(1, 4);

However the program is only looking for numbers 1-3.

In the max value of .Next(1,4); How come 4 is never picked? 1 would be the minimum, 4 would be the maximum.

If we are only looking for three numbers, 1, 2, 3

Why not do this?

int head = Random.Next(1, 3);

Set the maximum to 3? If you set it to 4, do you not risk getting a 4?

Thanks!

Do you?
What you’re saying is that you should look up the documentation for that method.

2 Likes