Random Seed

  • Thread starter Thread starter vibajajo
  • Start date Start date
V

vibajajo

Guest
I have a table with 100,000 records. I need to be able to select 200 records at random using a random seed supplied by me, not the system clock. I need for another person using the same table to use the same random seed as me and get the same 200 random records. Does anyone know how to do this?

Thanks,

Vince
 
When you select them, are you showing them through a query? If so then change the query to a make table query and then you will have the records until you rerun and change your selection
 
Would adding check box to the table and marking the 200 records with true be an option?

Then any user could query for the records that are true and get the same result set.
 
OK - This might not be elegant but it will work.

Lets assume you have a field in your primary table that numbers each record sequentially from 1 stepping up in integer values of 1

ie. 1,2,3,4,5......100,000

open a new Excel spreadsheet. in cell A1 enter the formula

INT(RAND()*100000)+1

Copy this formula down for say 250 rows.

You will get radom numbers in the range 1 - 100,000 but as they are truly random you may get duplicate values hence the extra lines.

Select the entire column and use edit copy click into say cell C1 and use edit paste special - as values into this column
You will notice the values in column A update to a ne set of random values. You could run this any number of times pasting the values into a new column each time. This will allow you to record/track the values you have used before.

Having got your values you can link to this worksheet as a table use a duplicate values query to eliminate any duplicate entries and then take the top 200 records. If you then link this table to your original table on the basis that you only want records where both valus match you've got it.

As I said not elegant-but it works.

Cheers
 
I put a random test generator on this thread which selects 30 random records from a recordset.

You could adapt it to meet your needs.
 
Miles,

Would it be possible for me to pick the seed myself using you random generator?

Thanks
 
You could specify the "seed" and pass it into the code and it should only pick out random records within that range.
 
In the code there's a part where it specified the number of records to get and, if I remember rightly, it picks random numbers based on their autonumber.

You could add a bit into the code that checks if a random record is valid by evaluating if it is within the range you want, if it isn't discard it.

I haven't looked at the code since I posted it so I can't remember it offhand.
 

Users who are viewing this thread

Back
Top Bottom