It’s been a while since I proposed a coding challenge, so I’ve been thinking about another one. Coming up with original problems that are not solved with a simple Google search is not easy, but I think this new one, while not especially hard, should produce some interesting and creative results.

This problem comes in two parts. The first part is more of a warm up since it’s very easy to look up, but the follow up question will, hopefully, be the source of innovative answers.

Here it is:

1) Write a function which, passed an int n, returns an array of size n containing all the numbers between 0 and n-1 in random order. For example, with n=5, valid answers are [0, 2, 3, 1, 4], [4, 1, 2, 0, 3], etc…
2) Prove that the function you wrote in 1) returns “really random” arrays.

I’m being intentionally vague on how to answer the second question in order not to lead the answers, but hopefully, the question is specific enough that no further clarifications is needed. Feel free to ask in the comments otherwise.

All languages welcome, and I suggest you use pastebin to submit your code.