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?.
Asked
Active
Viewed 312 times
-1
-
Possible duplicate of [Pick Random String From Array](https://stackoverflow.com/questions/6695187/pick-random-string-from-array) – Amir Dora. Jun 16 '18 at 09: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! – Amir Dora. Jun 16 '18 at 09:15
-
I did I don't know why I didn't seem to come across that – Glenn Spofford Jun 16 '18 at 09:29
1 Answers
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];

Saeed Bolhasani
- 552
- 3
- 15