org.uncommons.watchmaker.framework.factories
Class BitStringFactory
java.lang.Object
org.uncommons.watchmaker.framework.factories.AbstractCandidateFactory<BitString>
org.uncommons.watchmaker.framework.factories.BitStringFactory
- All Implemented Interfaces:
- CandidateFactory<BitString>
public class BitStringFactory
- extends AbstractCandidateFactory<BitString>
General purpose candidate factory for generating bit strings for
genetic algorithms.
- Author:
- Daniel Dyer
- See Also:
BitString
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BitStringFactory
public BitStringFactory(int length)
- Parameters:
length
- The length of all bit strings created by this
factory.
generateRandomCandidate
public BitString generateRandomCandidate(Random rng)
- Generates a random bit string, with a uniform distribution of
ones and zeroes.
- Parameters:
rng
- The source of randomness for setting the bits.
- Returns:
- A random bit string of the length configured for this
factory.