Random method without repeating
#1

Well,i'm working on a easter egg system with random coordinates,at this point,it just fine.

But,i'm worried about the random function,how can i use it without repeat any of the coordinates ?
My last try was that,from other system with other ends:

PHP код:
new Float:EasterEggs[][]=
{
    {
XYZ},
    {
XYZ},
    {
XYZ},
    
//etc..
};
new 
cCheck[sizeof(EasterEggs)];
public 
OnFilterScriptInit()
{
    new 
randomCoordSelectCoord;
    do{
        for(new 
0sizeof(cCheck);i++)
        {
            if(
cCheck[i] != 0SelectCoord++;
            if(
SelectCoord == sizeof(cCheck[i]))
            {
                for(new 
0sizeof(cCheck); i++)
                {
                     
cCheck[i] = 0;
                     
randomCoord random(sizeof(EasterEggs));
                }while(
cCheck[randomCoord])
                {
                    
CreateEE(EasterEggs[randomCoord][0],EasterEggs[randomCoord][1],EasterEggs[randomCoord][2]);
                }
            }
         }
      }

So,what you think guys ?Did you know some method to not repeat with the random function ?
Reply


Messages In This Thread
Random method without repeating - by Detoria - 06.03.2015, 23:14
Re : Random method without repeating - by Golimad - 06.03.2015, 23:25
Re: Re : Random method without repeating - by Detoria - 06.03.2015, 23:27
Re : Random method without repeating - by Golimad - 06.03.2015, 23:30
Re: Re : Random method without repeating - by Detoria - 06.03.2015, 23:32
Re : Random method without repeating - by Golimad - 06.03.2015, 23:38
Re: Random method without repeating - by Detoria - 06.03.2015, 23:45
Re : Random method without repeating - by Golimad - 06.03.2015, 23:52
Re: Random method without repeating - by Detoria - 07.03.2015, 00:18
AW: Re : Random method without repeating - by Nero_3D - 07.03.2015, 00:21

Forum Jump:


Users browsing this thread: 1 Guest(s)