Added random state feature