random static method
Returns a DNA
object with a specified length of len
.
Implementation
static DNA random({required int len}) {
Random _rand = Random();
String dnaNucsStr = dnaNucs.join();
String seq = String.fromCharCodes(
Iterable.generate(
len,
(_) => dnaNucsStr.codeUnitAt(
_rand.nextInt(dnaNucsStr.length),
),
),
);
return DNA(seq: seq);
}