private int randomValue ( IntVar x ) { int i = rnd . nextInt ( x . getDomainSize ( ) ) ; DisposableValueIterator ite = x . getValueIterator ( true ) ; int pos = - 1 ; try { while ( i >= 0 ) { pos = ite . next ( ) ; i -- ; } } finally { ite . dispose ( ) ; } return pos ; }
Pick a random value inside the variable domain .