random static method

Peptide random(
  1. {required int len}
)

Returns a Peptide object with a specified length of len.

Implementation

static Peptide random({required int len}) {
  Random _rand = Random();
  String aminoAcidsStr = aminoAcids.join();
  String seq = String.fromCharCodes(
    Iterable.generate(
      len,
      (_) => aminoAcidsStr.codeUnitAt(
        _rand.nextInt(aminoAcidsStr.length),
      ),
    ),
  );
  return Peptide(seq: seq);
}