proc randomInit {seed} { ns_share -init { set rand(ia) 9301 set rand(ic) 49297 set rand(im) 233280 set rand(seed) $seed } rand } # initialize the random number generator randomInit [ns_time] proc random {} { ns_share rand set rand(seed) [expr ($rand(seed) * $rand(ia) + $rand(ic)) % $rand(im)] return [expr $rand(seed)/double($rand(im))] } proc randomRange {range} { return [expr int([random] * $range)] } # -- everything above this comment goes in a private or shared Tcl # directory to be loaded at server start-up ------------------ proc choose_n_random {choices_list n_to_choose chosen_list} { if { $n_to_choose == 0 } { return $chosen_list } else { set chosen_index [randomRange [llength $choices_list]] set new_chosen_list [lappend chosen_list [lindex $choices_list $chosen_index]] set new_n_to_choose [expr $n_to_choose - 1] set new_choices_list [lreplace $choices_list $chosen_index $chosen_index] return [choose_n_random $new_choices_list $new_n_to_choose $new_chosen_list] } } proc one_person {person} { set name [lindex $person 0] set title [lindex $person 1] set achievement [lindex $person 2] return "

$title $name

\n $achievement

\n" } ReturnHeaders ns_write " Aid to Evaluating Your Accomplishments

Aid to Evaluating Your Accomplishments

part of Career Guide for Engineers and Scientists
Compare yourself to these average people who were selected at random:

" # each person is name, title, accomplishment(s) set einstein [list "A. Einstein" "Patent Office Clerk" "Formulated Theory of Relativity."] set mill [list "John Stuart Mill" "English Youth" "Was able to read Greek and Latin at age 3."] set weiner [list "Norbert Weiner" "Encyclopedia Americana staff writer" "Received Ph.D. from Harvard at age 18, subsequently founded field of communication science/cybernetics."] set mozart [list "W. A. Mozart" "Viennese Pauper" "Composed his first opera, La finta semplice, at the age of 12."] set curie [list "Marya Sklodowska" "Polish Student" "Received Nobel Prize in Physics (1903) and in Chemistry (1911), under the name \"Marie Curie\". She was the first woman to win a Nobel prize."] set marcus [list "Marcus Aurelius" "Stoic Philosopher" "Ruled the entire world as it was known in his day; was the only Roman Emperor to refrain from disgracing himself."] set hubbard [list "L. Ron Hubbard" "Science Fiction Author" "Created the religion of Scientology in 1950. 1998 membership: more than one million."] set ellison [list "Larry Ellison" "Unemployed Californian" "After being divorced by his first wife because she said that he would never amount to anything or make any money, started Oracle Corporation, world's leading supplier of relational database management software (Note to MIT computer scientists: you don't need to know anything about RDBMS because it isn't useful for word processing (unless you want versioning))."] set jesus [list "Jesus of Nazareth" "Judean Carpenter" "Told young women he was God and they believed him."] set stevens [list "Wallace Stevens" "Hartford Connecticut Insurance Executive" "Won Pulitzer Prize for Poetry in 1954; best known for \"Thirteen Ways of Looking at a Blackbird\"."] set alexander [list "Alexander III" "Macedonian Youth" "Conquered 90% of known world by age 30."] set average_folks [list $einstein $mill $weiner $mozart $curie $marcus $hubbard $ellison $jesus $stevens] set four_average_folks [choose_n_random $average_folks 4 [list]] ns_write "
[one_person [lindex $four_average_folks 0]] [one_person [lindex $four_average_folks 1]]
[one_person [lindex $four_average_folks 2]] [one_person [lindex $four_average_folks 3]]
" ns_write "

Programmed by Eve Astrid Andersson and Philip Greenspun in AOLserver Tcl.