mercredi 16 août 2017

Randomize LuisDialog answer

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);
    }




Aucun commentaire:

Enregistrer un commentaire