Unique groups of numbers - page 3

 

This is what worked for me, Thanks WHRoeder

/**
  neural Shuffler for Neural Formula
**/  
void  ShuffleI(int& values[], int nValues=WHOLE_ARRAY, int iBeg=0)
{
   if(nValues == WHOLE_ARRAY) nValues = ArraySize(values) - iBeg;
   int iEnd = iBeg + nValues - 1;
   for(int iValue = iEnd; iValue >= iBeg; iValue--){
      int iRand = Random(iBeg, iEnd);
      SwapI(values, iRand, iValue);
   }
}
void  SwapI(int& v[], int a, int b){ int tmp = v[a]; v[a] = v[b]; v[b] = tmp; }
int   Random(int min, int max){ return(MathRand() / 32768.0*(max-min+1)+min); }  
 
Louis Stoltz:
Say for example I have a range of numbers I can use from 1 - 10 ok.
What I actually want is unique sequences of that range, ie.
10,9,7,8,4,6,5,1,3,2
2,1,4,3,5,6,7,8,9,10

I know you can shuffle arrays but how do get uniques shuffles with maybe a seed number like srand to create

random groups of numbers between 10 and 1?

Thanks in advance

here is another example to get random value from a numbers list.

int list[] = {23, 38, 50, 61,107,123};
int randCell = list[ rand()%ArraySize(list)  ];
Comment("Randnum = ",randCell);

every time value change when this function execute. randCell get value from you list 

23, 38, 50, 61,107,123

i hope it will help you 

Reason: