The following code will take a number that will be used to define the number of times a loop is performed. Each time the loop is performed a new random character is added to the end of the string. benchmark BenchmarkName use "kernel.bdh" var dclrand rsletter : RndStr (1..1); dcluser user VirtUser transactions TmyTrans1 : 1; // Transactions dclfunc function FMyFunction(size : number) : string // takes a number in and returns a string var sMainString : string; count : number; randletter : string; begin for count := 0 to size do // add 1 character the number of times specified by the size parameter randletter := rsletter ; //assign randomstring into variable sMainString := Strcat(sMainString,randletter); //concatenate the letter to the current string end; //end loop FMyFunction := sMainString; writeln ("final =" +sMainString); end FMyFunction; dcltrans transaction TmyTrans1 begin fMyfunction(5); //call function with size of 5 end TmyTrans1;
↧