[REP++] Generating some numbers
#6

I'm pretty sure it's optimizable :
PHP код:
DistinctNumber(number)
{
    new
        
string[50],
        
count,
        
bool:sameNB false;
    do
    {
        
string[count] = random(number);
        for(new 
inumberi++)
        {
            if(
count == i)
                continue;
            if(
string[count] == string[i])
                
sameNB true;
        }
        if(!
sameNB)
            
count++;
        
sameNB false;
    }
    while(
count != number);
    return 
string;

Also, change 50 by the max number you will generate in your script
Reply


Messages In This Thread
[REP++] Generating some numbers - by buburuzu19 - 28.04.2017, 15:10
Re: [REP++] Generating some numbers - by Eoussama - 28.04.2017, 15:12
Re: [REP++] Generating some numbers - by buburuzu19 - 28.04.2017, 15:20
Re: [REP++] Generating some numbers - by Dayrion - 28.04.2017, 15:24
Re: [REP++] Generating some numbers - by SyS - 28.04.2017, 15:25
Re: [REP++] Generating some numbers - by Dayrion - 28.04.2017, 15:36
Re: [REP++] Generating some numbers - by SyS - 28.04.2017, 15:50

Forum Jump:


Users browsing this thread: 1 Guest(s)