How to make constraint works like $countones()

how to make constraint works like $countones()

In reply to Neel_7586:

how to make constraint works like $countones()

You can use $countones in a constraint directly. For example

std::randomize(a) with {$countones(a) == 10;};

In reply to Neel_7586:

Your requirement isn’t clear .
Are you looking for an alternative to $countones ?