random seed and conditional function added