4) Let rand (n) be a library function that evaluates to a random integer in Z each time it is called (like Java's Random.nextInt (n)). Write a method called createRandomFunction (right here in your written homework) in C or Java that takes a positive integer as a parameter and returns an array with n elements each uniformly distributed in Z Essentially I'm asking you to write a method that specifies a random function Z" Zn using the table filling method (ie, a- createRandomFunction (10) fills a with random values and then a[o] would tell you what 0 maps to, a1] tells you what 1 maps to, etc.)
Explanation / Answer
public static int[] createRandomFunction(int n) { int[] arr = new int[n]; for(int i = 0; i