Challenge: Write Code with Worker Pool Pattern

Learn to write code using the worker pool pattern.

We'll cover the following

Problem statement

Write code that generates random integers less than or equal to 1,000 and calculates the sum of digits of each of the integers while following the instructions below:

  • Don’t create any global variables.
  • Create a pool of 10 workers.
  • Create 50 jobs. Assign each one a job number (id) and a random integer (randomno) using Job struct, and pass them to the jobs channel.
  • Create a buffer channel of size 10.
  • Use the following structs:

Get hands-on with 1400+ tech skills courses.