A generator is a method that returns a channel. The one below creates a channel and writes a given number of messages asynchronously from a separate thread.
By returning a ChannelReader
we ensure that our consumers won't be able to attempt writing to it.
That's how we use the generator.