On 11/7/19 5:13 PM, Doug Currie wrote: > On Thu, Nov 7, 2019 at 4:23 PM Richard Damon <rich...@damon-family.org> > wrote: > >> One thought would be to generate a ‘hash’ from part of the record, maybe >> the record ID, and select records based on that value. The simplest would >> be something like id%100 == 0 would get you 1% of the records. That >> admittedly isn’t that random. >> >> Put the ID through a linear congruential generator, something like >> >> mod(a * Id + b, c) % 100 == 0 >> >> And you will pretty well scramble the selection >> >> > Yes, and if a, b, and c come from a randomization table, they can be > modified to obtain a different pseudo-random set. > > e a, b, and c should be chosen to give a reasonable random number generator (there are tables of good values), not be arbitrary values. The 100 and the 0 can be changed (or use some other test on the random number) to get different selections.
-- Richard Damon _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users