another rand helper function might help