getRandom method
Get a random element from List.
If seed
is specified, a random value is obtained according to the seed.
Listからランダムに要素を取得します。
seed
を指定するとシードに応じたランダム値を取得します。
Implementation
T? getRandom([int? seed]) {
if (isEmpty) {
return null;
}
final index = Random(seed).nextInt(length);
return this[index];
}