How to create randoms with exceptions
#2

I did that but I think you can optimize it.
PHP код:
main()
{
    
printf("%i"randomEx(5_01245)); // print 3
}

randomEx(maxmin 0, ...)
{
    new
        
maxarg numargs(),
        
nb random(max min) + min;

    while(
maxarg != 0)
    {
        if(
nb == getarg(maxarg))
        {
            
maxarg numargs();
            
nb random(max min) + min;
        }
        else
            
maxarg--;
    }
    
    return 
nb;

Reply


Messages In This Thread
How to create randoms with exceptions - by coool - 17.12.2016, 12:44
Re: How to create randoms with exceptions - by Dayrion - 17.12.2016, 12:54
Re: How to create randoms with exceptions - by NaS - 17.12.2016, 15:47
Re: How to create randoms with exceptions - by coool - 17.12.2016, 15:58
Re: How to create randoms with exceptions - by SickAttack - 17.12.2016, 16:07
Re: How to create randoms with exceptions - by NaS - 17.12.2016, 16:56

Forum Jump:


Users browsing this thread: 1 Guest(s)