added optional seed for random number generator