Subject Re: [firebird-support] Re: Random Records
Author Alexandre Benson Smith
Lester Caine wrote:

>Sorry - the reason I've got to match the RAND operator is because this
>is a cross database project ( bitweaver! ) and I can change the
>structure or add triggers to the many tables that I need a result from.
>Ivan - The unsorted random is what I am using now, but it tents to throw
>up the same random page as 'pick of the day' every day - not
>particularly random - which is why I am trying to craft something that
>will fit into ADOdb's sort order selection in some way.
>Ideally anything that throws up a different article/blog/product/wiki
>etc each time you access a site that is using 'pick of the day' and
>similar random displays. I don't use it myself, but it's logged as a bog
>against Firebird at present :(


I have tried the obvious solution, and of course it does not work :-)

I declared the Rand UDF and tried

A.A, Rand()
order by

The order of the records are always the same since Rand Returns the same
value for all records, the result tend to be identical to a select
without an order by.

But, What about if you try to write an UDF that returns random numbers
not based on system time (as rand do) and use the previous number as a
seed for the next one ?

see you !

Alexandre Benson Smith
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil