shuffleUtxos method

List<Utxo> shuffleUtxos()

Implementation

List<Utxo> shuffleUtxos() {
  List<Utxo> items = map.values.toList();
  var random = new Random();
  // Go through all elements.
  for (var i = items.length - 1; i > 0; i--) {
    // Pick a pseudorandom number according to the list length
    var n = random.nextInt(i + 1);
    var temp = items[i];
    items[i] = items[n];
    items[n] = temp;
  }
  return items;
}