fixed random_seed to be less subtlely wrong when invoked as a function