1. Learn
  2. /
  3. Courses
  4. /
  5. Parallel Computing in R

Exercise

Setting an RNG

In this exercise, you will look at the impact of the clusterSetRNGStream() function by checking the RNG kind before and after the RNG initialization.

clusterSetRNGStream() takes two arguments: a cluster object, and an integer for the random seed.

parallel is loaded in your workspace.

Instructions

100 XP
  • Create a cluster object cl with two workers.
  • Call the RNGkind() function on all workers using clusterCall().
  • Set the RNG seed of the cluster to 100 using clusterSetRNGStream().
  • Check the RNGkind() on workers again as in the second step. How did the RNG change?