coinToss<T> function

T coinToss<T>(
  1. T object1,
  2. T object2
)

randomly returns either object1 or object2

Implementation

T coinToss<T>(T object1, T object2) =>
    (_random.nextInt(100) > 50) ? object1 : object2;