Added call to srand() to seed the RNG