# Generating Random Sequence of A Set of Ordered Co-ordinates

I need to take a sequenced set of coordinates and then make a random order of them just like the picture above. I am stuck up. Kindly help

Where is the problem? You do not know how to generate random numbers? Try to use Google for query “random cpp”…

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
void urand(int lim,int a[])
{ float k;
int i,j,b[lim],temp,index=0,flag=0;
srand ( time(NULL) );
while(index<=lim)
{
temp=rand()%10;
//printf(“temp=%d\n”,temp);
if(index==0){
b[index]=temp;
//printf(“ftemp=%d\n”,temp);
index++;
}
else {
for(i=0;i<=index;i++){
if(temp==b[i]){
flag=0;
break;
}
else flag=1;
}
if(flag==1){
b[index]=temp;
index++;
}
}
k++;
if(k>=100)break;
}
for(i=0;i<index;i++){
a[i]=b[i];
}
}

``````int main()
{
int m,a1[10][10],n,b[10],i,j;
float d[10],e[10],c[10],pxr[10],pyr[10],pzr[10];

for(i=0;i<10;i++){
scanf("%f%f%f",&c[i],&d[i],&e[i]);
/*c[i]=i;
d[i]=i;
e[i]=i;*/
//printf("%d %d %d\n",c[i],d[i],e[i]);
}
urand(9,b);

//printf("%d %d\n",b[9],c[9]);
for(m=0;m<10;m++){
printf("%.2f  %.2f  %.2f --> %.2f  %.2f %.2f \n",c[m],d[m],e[m],c[b[m]],d[b[m]],e[b[m]]);
/*pxr[m]=c[b[m]];
pyr[m]=d[b[m]];
pzr[m]=e[b[m]];*/

}

}``````
//