It looks like the equation in Valence may be fired more than once. To ensure that a random number is only generated once, use this in Valence:
{if(is_empty(Valence), rand(1,2), Valence)}