Fixed rand seed bug