```
double[][] a= new double[5][5];
int i,j;
int [] controller= new int[5];
Random rand=new Random();
for(i=0; i<5; i++ )
{
for(j=0; j<5; j++)
{
do
{
a[i][j]= rand.nextDouble();
if(a[i][j]>0.0)
controller[j]++;
System.out.println("a[" + i + "][" + j + "] = " +a[i][j]);
}while( controller[j]==3);
}
}
```

/* I create some random coordinates using this code snippet.Then i need to create a connected graph of these random coordinates.I take some random value r and then compare between the distances of the points,after comparison i join them if distance d < r.I know the logic,i dont know how to code this.Can u please help me in this.

Thank you in advance.