1. 学ぶ
  2. /
  3. コース
  4. /
  5. Parallel Programming in R

Connected

演習

Reproducible lottery results

You work as a programmer for an online lottery. By law, the winners have to be selected randomly and the selection has to be transparent.

In your workspace you have a list of lottery tickets, ls_tickets. There are 51 elements in ls_tickets, one for each US state. Each element of this list contains lottery ticket numbers. In your workspace, you have a function, lottery(), that randomly selects the winning ticket for each state. You are testing the lottery() function by applying it to ls_tickets in parallel using future_map(). The problem is that the winners are different every time you run this code. The furrr package has been loaded for you.

指示

100 XP
  • Create a configuration for future_map().
  • Set the seed at 4321 in the configuration.
  • Supply this configuration to future_map().