Randomly select donor records given a probability weight vector. This sampling procedure is implemented differently than randSample_cpp to speed up performance of C++-function recordSwap().
NOTE: This is an internal function used for testing the C++-function sampleDonor which is used inside the C++-function recordSwap().

sampleDonor_cpp(
data,
similar_cpp,
hid,
IDswap,
IDswap_pool_vec,
prob,
seed = 123456L
)

## Arguments

data

micro data containing the hierarchy levels and household ID

similar_cpp

List where each entry corresponds to column indices of variables in data which should be considered when swapping households.

hid

column index in data which refers to the household identifier.

IDswap

vector containing records for which a donor needs to be sampled

IDswap_pool_vec

set from which IDswap was drawn

prob

a vector of probability weights for obtaining the elements of the vector being sampled.

seed

integer setting the sampling seed