implemented weighted prob