Added collision check in environment and updated random sampling