This code is not tested but it’s an example of adding a field and then getting results.
function bp_numb_add_reg_field() {
$rand_numb = //php to generate number here ;
echo '<input type="hidden" name="user_unique_id" value="'. $rand_numb .'" />';
}
add_action( 'bp_before_registration_submit_buttons', 'bp_numb_add_reg_field' );
function bp_numb_get_reg_data() {
if ( isset( $_POST['user_unique_id'] ) ) {
$numb_value = $_GET['user_unique_id'];
// do something with the custom data
}
}
add_action( 'bp_complete_signup', 'bp_numb_get_reg_data' );