pub fn create_random_group(
        &self,
        target_group_size: usize,
        ciphersuite: &Ciphersuite,
    ) -> Result<GroupId, SetupError> {
        // Create the initial group.
        let group_id = self.create_group(ciphersuite)?;

        let mut groups = self.groups.borrow_mut();
        let group = groups.get_mut(&group_id).unwrap();

        // Get new members to add to the group.
        let mut new_members = self.random_new_members_for_group(group, target_group_size - 1)?;

        // Add new members bit by bit.
        while !new_members.is_empty() {
            // Pick a random adder.
            let adder_id = group.random_group_member();
            // Add between 1 and 5 new members.
            let number_of_adds = ((OsRng.next_u32() as usize) % 5 % new_members.len()) + 1;
            let members_to_add = new_members.drain(0..number_of_adds).collect();
            self.add_clients(ActionType::Commit, group, &adder_id, members_to_add)?;
        }
        Ok(group_id)
    }
/// Create a random group of size `group_size` and return the `GroupId`
Create a random group of size `group_size` and return the `GroupId`
Create a random group of size ` group_size ` and return the ` GroupId `
pub fn create_random_group(
        &self,
        target_group_size: usize,
        ciphersuite: &Ciphersuite,
    ) -> Result<GroupId, SetupError> {
        // Create the initial group.
        let group_id = self.create_group(ciphersuite)?;
        let mut groups = self.groups.borrow_mut();
        let group = groups.get_mut(&group_id).unwrap();
        // Get new members to add to the group.
        let mut new_members = self.random_new_members_for_group(group, target_group_size - 1)?;
        // Add new members bit by bit.
        while !new_members.is_empty() {
            // Pick a random adder.
            let adder_id = group.random_group_member();
            // Add between 1 and 5 new members.
            let number_of_adds = ((OsRng.next_u32() as usize) % 5 % new_members.len()) + 1;
            let members_to_add = new_members.drain(0..number_of_adds).collect();
            self.add_clients(ActionType::Commit, group, &adder_id, members_to_add)?;
        }
        Ok(group_id)
    }
pub fn create_random_group ( & self , target_group_size : usize , ciphersuite : & Ciphersuite , ) -> Result < GroupId , SetupError > { // Create the initial group. let group_id = self . create_group ( ciphersuite ) ? ; let mut groups = self . groups . borrow_mut ( ) ; let group = groups . get_mut ( & group_id ) . unwrap ( ) ; // Get new members to add to the group. let mut new_members = self . random_new_members_for_group ( group , target_group_size - 1 ) ? ; // Add new members bit by bit. while ! new_members . is_empty ( ) { // Pick a random adder. let adder_id = group . random_group_member ( ) ; // Add between 1 and 5 new members. let number_of_adds = ( ( OsRng . next_u32 ( ) as usize ) % 5 % new_members . len ( ) ) + 1 ; let members_to_add = new_members . drain ( 0 .. number_of_adds ) . collect ( ) ; self . add_clients ( ActionType :: Commit , group , & adder_id , members_to_add ) ? ; } Ok ( group_id ) }
Create a random group of size `group_size` and return the `GroupId`
Create a random group of size ` group_size ` and return the ` GroupId `
&self
target_group_size
usize
ciphersuite
&Ciphersuite
&self
target_group_size
usize
ciphersuite
&Ciphersuite