Possible Duplicate:
Randomly pick k bits out of n from a Java BitSet
Is there an easy way to generate a random BitSet of size n*n (e.g. 64) and exactly n (e.q 8) number of 1's in a random order?
What Ive thought about is that I could possibly generate a random bitset and check if bitSet.cardinality() is 8 and try again if its not, but that seems like a performance-bad solution.
Anyone have a better idea?