Generates a set of Chi-Squared distributed values.

r_chisq(df, ..., n = default_n(df), .seed = NULL)

Arguments

df

degrees of freedom, strictly positive

...

Unused

n

number of observations to generate. The default_n() function will provide a default value within context

.seed

One of the following:

  • NULL (default) will not change the current seed. This is the usual case for generating random numbers.

  • A numeric value. This will be used to set the seed before generating the random numbers. This seed will be stored with the results.

  • TRUE. A random seed value will be generated and set as the seed before the results are generated. Again, this will be stored with the results.

To extract the random seed from a previously generated set of values, use pull_seed()

Value

A numeric vector of length n

Examples

set_n(5) r_chisq(10)
#> [1] 5.737369 10.713310 3.847531 8.323055 21.285822
r_chisq(1:10)
#> [1] 3.02373135 0.04336593 1.55135964 7.92908276 5.30589580 5.39357952 #> [7] 2.70534552 18.06687050 8.15473930 7.55150645
r_chisq(10, n = 10)
#> [1] 10.775293 10.150699 20.021060 7.202403 11.330275 8.568691 9.729134 #> [8] 10.042841 10.030551 7.934222