MCPcopy Create free account
hub / github.com/Gecode/gecode / randomTupleSet

Function randomTupleSet

test/int/extensional.cpp:643–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641 };
642
643 Gecode::TupleSet randomTupleSet(int n, int min, int max, double prob, Gecode::Support::RandomGenerator& rand) {
644 using namespace Gecode;
645 TupleSet t(n);
646 CpltAssignment ass(n, IntSet(min, max));
647 while (ass.has_more()) {
648 if (rand(100) <= prob*100) {
649 IntArgs tuple(n);
650 for (int i = n; i--; ) tuple[i] = ass[i];
651 t.add(tuple);
652 }
653 ass.next(rand);
654 }
655 t.finalize();
656 return t;
657 }
658
659 /// Help class to create and register tests
660 class Create {

Callers 1

CreateMethod · 0.85

Calls 5

IntSetClass · 0.85
has_moreMethod · 0.45
addMethod · 0.45
nextMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected