Back to Blog

More Old School Vugen Code For Randomization

Here is some old code I had laying around which simply illustrates how to randomize a VuGen parameter by using srand and randomizing a value used within the array. This assumes you are grabbing multiple values in the array using the web_reg_save_param() function with the ORD=ALL argument.

// Randomize based on total numbers of Beneficiaries and selecting one

srand( time(NULL) );
rnum1 = (rand () % atoi(lr_eval_string("{pBeneficiary_count}")) +1);

// Merge Parameter to include the random number just selected

 sprintf( buffer1,"{pBeneficiary_%d}",rnum1 );

// save converted string into a parameter for Beneficiary

 lr_save_string( lr_eval_string(buffer1),"pRndAccounts" );

Let us know your thoughts by leaving a comment below.

Back to Blog