def random_society(n_trustees): trustees = [Person.random_loanee() for i in range(n_trustees)] edges = [] for trustee in trustees: for other in random.sample(trustees, int(math.ceil(len(trustees)*trustee.friendliness))): if other == trustee: continue edges.append((trustee, other)) return LoanerSociety(edges)
def sim_n_rounds(self, n): for _ in range(n): self.simulate_round(Person.random_loanee())