Adds Shuffle method to Random interface for shuffling a slice. While
not in use yet, the method is required for selecting random host nodes
when a repository is being created.
NewLockedRandom implements a mutex protected wrapper for Random.
Currently it was implemented with a function wrapper. As we need more
than one method now, this commit changes the implementation in to a
struct and adds the Shuffle method on it.
The interface is also implemented by mockRandom which is used for mocking
out a Random during tests. mockRandom also gains the Shuffle function so
it implements the updated interface.
This commit moves Random to it's own file and introduces a wrapper
to make Random safe for concurrent use. The global random in Go
is safe for concurrent use but random instances created otherwise
are not. Adding a locked wrapper allows us to inject a random in to
per repository router and have it provide safe safe access as the
global.