partialView

fun partialView(self: PeerId, roster: Set<PeerId>, k: Int, spareCount: Int, random: Random): PartialView

Derives this peer's PartialView from the full roster as a seeded random k-out sample (excluding self): shuffle the other peers and take the first k as PartialView.active, then up to spareCount more as disjoint PartialView.spares. Both are capped by the number of available peers.

Random k-out (rather than a hash ring) is robust against skewed peer-id distributions. random must be seeded per-peer by the caller (e.g. from the peer's identity) so peers choose independently — a shared seed would make every peer pick the same neighbours, collapsing the random graph.