3 Replies Latest reply: Apr 1, 2015 7:29 AM by Puttemans Johan

# Assign random number

Hi all,

I have a table of around 750.000 lines, in which around 20 products are comprised over these lines. My issue is that the table is ordered on the product type, and so product 1 will be stting in the first lines, and product 20 in the last lines (I don't easily know how many lines each product has).

My wish is to assign a random number (from 1 to 750.000) to each line in the table, so that when I order the table on the random number, all products are mixed. I've looked at Autonumber and Rand, but those don't seem to be helpful.

Is there any other solution possible?

Thanks

• ###### Re: Assign random number

RowNo() as ID is not working for you..

Or you are looking for something different?

Can you provide little 5-6 line sample with your required output?

• ###### Re: Assign random number

Try ceil(Rand()*750000))

• ###### Re: Assign random number

Thank you, this does the job perfectly. With the function, I now get an average that has only a spread between the different products of around 35.000, whereas it used to be 12.100.000 with the ordered table. So this is certainly an improvement. (average calculated over either the line ID = rowno and the solution above)