# This section generates random red, green and blue values for
# the background, then emits the body tag with those colors
random seed
set red [format %02x [expr [random 128] + 128]]
set green [format %02x [random 256]]
set blue [format %02x [expr [random 128] + 128]]
html ""
Here are Ten More Losing Picks For The Texas Lottery
# This section creates a new procedure, a command that can be
# used in the page. This procedure is lotto_pick, and it creates
# the variable picks. It then creates six numbers at random from
# 1 to 50, checks that it hasn't already part of the lottery pick,
# and if not, adds it to the list in picks. Finally, it takes the
# number created, and emits the html to show the number as a row in
# a table
proc lotto_pick {} {
set picks ""
for {set i 0} {$i < 6} {incr i} {
while 1 {
set pick [expr [random 50] + 1]
if {[lsearch $picks $pick] >= 0} continue
lappend picks $pick
break
}
}
html ""
foreach pick [lsort -integer $picks] {
html "$pick | "
}
html "
"
}
# The code in this section starts the html table. It then
# executes the procedure lotto_pick 10 times, and finally
# closes the table.
html ""
for {set i 0} {$i < 10} {incr i} {
lotto_pick
}
html "
"