The R Project SVN R

Rev

Rev 68947 | Rev 86200 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68947 Rev 76160
Line 313... Line 313...
313
    if (!x) MATHLIB_ERROR(_("wilcox allocation error %d"), 4);
313
    if (!x) MATHLIB_ERROR(_("wilcox allocation error %d"), 4);
314
#endif
314
#endif
315
    for (i = 0; i < k; i++)
315
    for (i = 0; i < k; i++)
316
	x[i] = i;
316
	x[i] = i;
317
    for (i = 0; i < n; i++) {
317
    for (i = 0; i < n; i++) {
318
	j = (int) floor(k * unif_rand());
318
	j = (int) R_unif_index(k);
319
	r += x[j];
319
	r += x[j];
320
	x[j] = x[--k];
320
	x[j] = x[--k];
321
    }
321
    }
322
    free(x);
322
    free(x);
323
    return(r - n * (n - 1) / 2);
323
    return(r - n * (n - 1) / 2);