1111 }
1212
1313void
14- simulate (
15- tsk_table_collection_t * tables , int N , int T , int simplify_interval )
14+ simulate (tsk_table_collection_t * tables , int N , int T , int simplify_interval )
1615{
1716 tsk_id_t * buffer , * parents , * children , child , left_parent , right_parent ;
1817 double breakpoint ;
@@ -44,10 +43,10 @@ simulate(
4443 * research code and proper random number generator
4544 * libraries should be preferred.
4645 */
47- left_parent = parents [(size_t )((rand ()/ (1. + RAND_MAX ))* N )];
48- right_parent = parents [(size_t )((rand ()/ (1. + RAND_MAX ))* N )];
46+ left_parent = parents [(size_t ) ((rand () / (1. + RAND_MAX )) * N )];
47+ right_parent = parents [(size_t ) ((rand () / (1. + RAND_MAX )) * N )];
4948 do {
50- breakpoint = rand ()/ (1. + RAND_MAX );
49+ breakpoint = rand () / (1. + RAND_MAX );
5150 } while (breakpoint == 0 ); /* tiny proba of breakpoint being 0 */
5251 ret = tsk_edge_table_add_row (
5352 & tables -> edges , 0 , breakpoint , left_parent , child , NULL , 0 );
@@ -58,18 +57,15 @@ simulate(
5857 children [j ] = child ;
5958 }
6059 if (t % simplify_interval == 0 ) {
61- printf ("Simplify at generation %lld: (%lld nodes %lld edges)" ,
62- (long long ) t ,
63- (long long ) tables -> nodes .num_rows ,
64- (long long ) tables -> edges .num_rows );
60+ printf ("Simplify at generation %lld: (%lld nodes %lld edges)" , (long long ) t ,
61+ (long long ) tables -> nodes .num_rows , (long long ) tables -> edges .num_rows );
6562 /* Note: Edges must be sorted for simplify to work, and we use a brute force
6663 * approach of sorting each time here for simplicity. This is inefficient. */
6764 ret = tsk_table_collection_sort (tables , NULL , 0 );
6865 check_tsk_error (ret );
6966 ret = tsk_table_collection_simplify (tables , children , N , 0 , NULL );
7067 check_tsk_error (ret );
71- printf (" -> (%lld nodes %lld edges)\n" ,
72- (long long ) tables -> nodes .num_rows ,
68+ printf (" -> (%lld nodes %lld edges)\n" , (long long ) tables -> nodes .num_rows ,
7369 (long long ) tables -> edges .num_rows );
7470 for (j = 0 ; j < N ; j ++ ) {
7571 children [j ] = j ;
@@ -90,7 +86,7 @@ main(int argc, char **argv)
9086 }
9187 ret = tsk_table_collection_init (& tables , 0 );
9288 check_tsk_error (ret );
93- srand ((unsigned )atoi (argv [5 ]));
89+ srand ((unsigned ) atoi (argv [5 ]));
9490 simulate (& tables , atoi (argv [1 ]), atoi (argv [2 ]), atoi (argv [3 ]));
9591
9692 /* Sort and index so that the result can be opened as a tree sequence */
0 commit comments