22.10.2017, 15:08
Hey. I'm looking for a function that will return a random word from the typed text.
Regards.
Regards.
RndWordFromSentence(txt[]){
new arr[20][30],cnt,cnt2;
for(new i,i2=strlen(txt); i < i2; i++){
switch(txt[i]){
case ' ',',':cnt++,cnt2=0;
default: arr[cnt][cnt2++]=txt[i];
}
}
return arr[random(cnt+1)];
}