Random word
#1

Hey. I'm looking for a function that will return a random word from the typed text.

Regards.
Reply
#2

Sorry, this section is for scripting help, not for script requestings.
Reply
#3

PHP код:
RndWordFromSentence(txt[]){
    new 
arr[20][30],cnt,cnt2;
    for(new 
i,i2=strlen(txt); i2i++){
        switch(
txt[i]){
            case 
' ',',':cnt++,cnt2=0;
            default: 
arr[cnt][cnt2++]=txt[i];
        }
    }
    return 
arr[random(cnt+1)];

print(RndWordFromSentence("Hello my name is jeff"));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)