Reputation: 885
Hi guys im trying to use Random.Next to try to randomize the answer of luis. Unfortunately it doest seems to work, it always returns zero.
[LuisIntent("Age")]
public async Task Age(IDialogContext context, LuisResult result)
{
Random random = new Random();
int randomNumber = random.Next(0, 1);
List<string> Answers = new List<string>();
Answers.Add("Are you serious?");
Answers.Add("A million!I am million years old!Any more questions?");
string message = Answers[randomNumber];
await context.PostAsync(message);
context.Done(true);
}
Upvotes: 0
Views: 51
Reputation: 18838
The problem comes from your random function. As, random.Next(m,n)
is a random number >=m
and <n
, so random.Next(0,1)
just generate 0. Hence, you should change it to random.Next(0,2)
.
Upvotes: 1