code: @Override
      public Optional<EventSelectionResult> select(BProgramSyncSnapshot bpss, Set<BEvent> selectableEvents) {
          if (selectableEvents.isEmpty()) {
              return Optional.empty();
          }
          BEvent chosen = new ArrayList<>(selectableEvents).get(rnd.nextInt(selectableEvents.size()));
          Set<BEvent> requested = bpss.getStatements().stream()
                                            .filter((SyncStatement stmt) -> stmt != null)
                                            .flatMap((SyncStatement stmt) -> stmt.getRequest().stream())
                                            .collect(Collectors.toSet());
          
          if (requested.contains(chosen)) {
              return Optional.of(new EventSelectionResult(chosen));
          } else {
              // that was an external event, need to find the first index
              return Optional.of(new EventSelectionResult(chosen, singleton(bpss.getExternalEvents().indexOf(chosen))));
          }
      }
docs: Randomly select an event from {@code selectableEvents}, or a non-blocked event from {@code externalEvents}, in case {@code selectableEvents} is empty.
  
  @param bpss a b-program at synchronization point.
  @param selectableEvents Set of events that can be selected.
  @return An optional event selection result.