-1

I am currently trying to make a array with 3 possible values of text like hi, hello, and hey for speech synthesizer I just don't know how would I make it say one of those values randomly?.

3
  • Possible duplicate of Pick Random String From Array Commented Jun 16, 2018 at 9:14
  • please consider doing a small search before posting your question, these type of basic questions are already asked by people! you can go check them out and upvote an answer that works for you! Commented Jun 16, 2018 at 9:15
  • I did I don't know why I didn't seem to come across that Commented Jun 16, 2018 at 9:29

1 Answer 1

0

use this code:

string[] words=new string[]{"hi","Hello","Hey"};

Random r = new Random();
int i= r.Next(0, 2);

string randomWord= words[i];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.