Thanks Alex, will try it out!
On Mon, Apr 6, 2009 at 7:30 AM, Alexander Burger <a...@software-lab.de> wrot= e: > Hi Henrik, > >> Imagine having thousands of articles in a database, AFAIK using >> collect to get them all and then getting a random subsection would not >> be the best solution as the process would eat up a lot of memory. > > You could use 'maxKey' to get the highest key in the database, and then > use 'rand' repeatedly to find objects with 'db': > > =A0 (let Max (maxKey (tree 'aid '+Article)) > =A0 =A0 =A0(do 100 > =A0 =A0 =A0 =A0 (until (db 'aid '+Article (rand 1 Max))) > =A0 =A0 =A0 =A0 (printsp @) ) ) > > Cheers, > - Alex > -- > UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe > -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe