Erick wants to create the NumberFilter interface that should implement the Process() method to filter the prime numbers from a slice with many integer numbers.
He has already created the PrimeNumbers type, the Process() method, and the isPrime() function to verify if the number is prime or not. Now you need to help Erick with the following tasks:
- Create the
NumberFilterinterface that implements theProcess()method. Note thatProcess()takes a slice of integers[]intas an argument; - Declare the
numFiltervariable, and assign to itPrimeNumberswith thenumbersslice as an argument; - Call the
Process()method on thenumFiltervariable and then output thefilteredNumbers.
This problem uses the
math/rand package to generate a slice with random numbers via the hidden generateRandomNumbers() function. However, don't be scared! You don't need to know how the math/rand package works to solve this problem.