Fixed a random states test bug due to out of bounds access.