Test Script 1

set ret [list]
foreach line [split [getpage 0] \n] {
    set ret [linsert $ret [expr int(rand() * [llength $ret])] $line]
}

puts [join $ret \n]

puts ""

while 1 {
  set pageId [expr int(rand() * [countpages])]
  set pageText [getpage $pageId]
  if {$pageText == ""} {
    continue
  }
  puts "** \[[gettitle $pageId]\] **"
  puts $pageText
  break
}

return