Moved random functions to core