Hope this helps:
tell application "DEVONthink Pro"
set db to database 1
repeat
try
set dum to count parents of the db
set num to random number from 1 to dum
set mum to parent num of the db
set chum to count mum's children
set num to random number from 1 to chum
set kiddo to child num of mum
if kiddo's type is not group then exit repeat
end try
end repeat
set the record of window 1 to kiddo
end tell