Add validation; better randomness handling