andrew_C1
Nov 30, 2015Nimbostratus
is there a way to pick a random entry from a list
I have implemented an F5 as a double nat device where both sides have overlapping address space. As a result i have no routing configured on the F5 but use irules to set next hops etc. Because of this setup standard load balancing instantly fails (no routes). Now i can get around that pretty easy
when DNS_REQUEST {
set members [active_members -list $static::dns_pool]
log local5. " set destination dns server [lindex $members end]"
node [lindex $members end]
nexthop $next_vlan $next_hop
}
So the question is how can i pick at random a member out of $members? In perl its as simple as "my $element = $array->[ rand(@$array) ]" but i dont know TCL very well
cheers