If you need an exact number of random sample records, maybe you can use something along these lines:
Let vNumRecords = 1000;
Let vNumSamples = 100;
// Create Sample Set of Recno's
WHERE NOT EXISTS(SampleRecno) and Rowno() < $(vNumSamples);
LOAD Ceil(Rand()*$(vNumRecords)) as SampleRecno
While iterno() <=$(vNumRecords);
//Create test data
LOAD Keepchar(Hash256(RAND()),'ABCDEFG') as Customer,
Recno() as CustomerID
//Filter sample data set
LOAD Customer as CustomerSample,
WHERE EXISTS(SampleRecno, CustomerID);
comm226697.qvw 168.0 K
Glad this resolved your issue.
Just ensure in the SampleRecno generation that you are generating much more records (iterno() <= $(vNumRecords) than you want to receive as sample records, or in other words, vNumRecords should be much larger than vNumSamples.
That's due to the brute force algorithm to produce the fixed number of random sample values.