[Include] Shuffle array
#1

Shuffle array
Hello i made this simple include for shuffling arrays.
It uses random() function to put elements random order in array.

function: ShuffleArray(numbers[],amount)

Example
PHP код:
CMD:shuffle(playerid){
    new 
string[10],string2[10];
    
format(string,sizeof(string), ShuffleArray({3,4,5,6,7}) );
    
format(string2,sizeof(string2),"%d%d%d%d%d",string[0],string[1],string[2],string[3],string[4] );
     
SendClientMessage(playerid,-1,string2);
    return 
1;

I hope it helps.
Reply
#2

I didn't got this include. Can you elaborate it more please?
Reply
#3

Example we have array with numbers 1,2,3,4,5 and we want to put them in random order.
like 4,3,5,1,2 and so on. Its for creating systems that would need elements in random order.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)