Learn R Programming

sdcMicro (version 5.7.8)

distributeRandom_cpp: Distribute

Description

Distribute `totalDraws` using ratio/probability vector `inputRatio` and randomly round each entry up or down such that the distribution results in an integer vector. Returns an integer vector containing the number of units in `totalDraws` distributetd according to proportions in `inputRatio`.
NOTE: This is an internal function used for testing the C++-function distributeRandom which is used inside the C++-function recordSwap().

Usage

distributeRandom_cpp(inputRatio, totalDraws, seed)

Arguments

inputRatio

vector containing ratios which are used to distribute number units in `totalDraws`.

totalDraws

number of units to distribute

seed

integer setting the sampling seed