static ISeq<CharacterGene> seq(
		final CharSeq chars,
		final IntRange lengthRange
	) {
		final var random = random();
		final var length = random.nextInt(lengthRange.min(), lengthRange.max());

		return MSeq.<CharacterGene>ofLength(length)
			.fill(() -> new CharacterGene(chars, random.nextInt(chars.length())))
			.toISeq();
	}
Create a new CharacterGene from the give character.

@param allele The allele.
@param validCharacters the valid characters for the new gene
@return a new {@code CharacterGene} with the given parameter
@throws NullPointerException if one of the arguments is {@code null}.
@throws IllegalArgumentException if the {@code validCharacters} are empty.
jenetics/src/main/java/io/jenetics/CharacterGene.java