Practical collapse

global option

Author

A Ginolhac

Published

September 22, 2025

Note

This practical has:

  • show-solution: true, solution are displayed.
  • collapse-solution: false, solution are not collapsed (collapsed is the usual default mode)
Generate 5 numbers from the uniform distribution between 0 and 1
Solution 1
runif(n = 5)
[1] 0.9829412 0.1028893 0.0241326 0.5241282 0.9408090

The next solution collapsed despite the global option because of its specific option: #| unilur-collapse: true

Generate 5 numbers from the uniform distribution between 5 and 10
 runif(n = 5, min = 5, max = 10)
[1] 5.791797 9.368037 6.141487 8.211036 5.391873
Generate 5 numbers from the strandard distribution
Solution 3
 rnorm(n = 5)
[1] -0.16776314 -1.41286238  0.03879815 -0.54060095 -1.75719883

Next block is also collapsed individually

Results are always changing, how to get identical random numbers?

Use the set.seed(xx) where xx is a fixed number.