Refactor random distribution code

- moved random number generation into own file
- wrote tests for beta distribution