randomListByRef( sub { my $arr; my ($C,$P,$R) = @_;
return ( byOr($arr, @_) && gcd($P,$R) == 1 ); },
[~~$aConst, 2, 7], [~~$aPower, 2, 7], [~~$aRoot, 2, 7] );
return ( byOr($arr, @_) && gcd($P,$R) == 1 ); },
[~~$aConst, 2, 7], [~~$aPower, 2, 7], [~~$aRoot, 2, 7] );
which would let you pick three new numbers $aConst, $aPower and $aRoot from 2-7 such that a) at least one of them is different from their original/current value [that's the byOr function call] and b) aPower and aRoot are relatively prime [that's the gcd part]. If anyone's interested, I'd be happy to provide the code for it.
[The random loop terminates stochastically, btw; in general, I've found that if the right combination of random numbers can't be found in 100 guesses, I probably programmed the condition wrong.]