dimanche 26 novembre 2017

I am not able to understand the following code lines

In the code subset:

for (i=0;i

for (j=0;j<n;j++)
    {
    if (i==j) c[i][j]=0;
    else c[i][j]=drand48()<lprob ? 1 : 0;
    }

the line

c[i][j]=drand48()

is not clear.

I understand that drand48 is for randomly assigning double value to the 2d array. 'lprob' is a variable defined by us.

1.Please specifically explain ' <1prob ? 1:0; ' part. What does it do on execution?

  1. What does the entity inside the functional bracket of drand48 denote?



Aucun commentaire:

Enregistrer un commentaire