If you define a positive number in the Randomly generated elements field of a QVT Launch Configuration, the transformation is executed in random mode, and produces approximately the number of new elements you defined. "Random mode" means that random top-level relations are choosen from the QVT transformation and are executed for randomly choosen source model elements. Traces are discarded after one relation tuple is executed. Thus, in the following example, the relation GenerateClass can generate new classes multiple times for one package (in contrast to non-random mode, where for every package exactly one class would be generated).
top relation GenerateClass { varName,randomName : String; enforce domain backward p : EUML::Generic::Kernel::UMLPackage { name = varName }; enforce domain forward cls : EUML::Generic::Kernel::UMLClass { the_owner = p, name = varName + '_Class'+randomName }; when { randomName=getRandomString(); } } query getRandomString () : String { '' }When being in random mode and an OCL expression calls a query named "getRandomString", actually a random string will be returned. You should call getRandomString() only in when or where clauses and not directly in object templates.