Annotation of loncom/html/adm/help/tex/Numerical_Response_Randomization.tex, revision 1.3

1.2       bowersj2    1: \label{Numerical_Response_Randomization}
1.1       bowersj2    2: 
                      3: For LON-CAPA, one of the most important functions is the \texttt{random}
                      4: function. Random takes three parameters: a \emph{lower limit}, an \emph{upper
                      5: limit}, and an \emph{interval}. The \texttt{\&random} function returns a
                      6: random value between the upper and lower limit, some integer number of \emph{interval}'s
                      7: away from the lower limit. Thus, for example, \texttt{\&random(1,2,.2)} might
                      8: return 1, 1.2, 1.4, 1.6, 1.8, or 2. \texttt{\&random} uses a uniform distribution.
                      9: Other distributions are available in LON-CAPA, and can be found by consulting
                     10: the function list.
                     11: 
                     12: %
                     13: \begin{figure}
                     14: \$a~=~\&random(1.0,10.0,1.0);
                     15: 
                     16: \$b~=~\&random(-10.0,~-3.0,~1.0);
                     17: 
                     18: \$answer~=~\$a+\$b;
                     19: 
1.3     ! raeburn    20: \caption{Sample \texttt{Random} Calls \label{Sample Random Calls figure}}
1.1       bowersj2   21: \end{figure}
                     22: If you put the script in ``Sample Random Calls'' into the
                     23: \textbf{Script} block (replacing whatever contents might be in the block
                     24: already), you'll get two random variables \$a and \$b. Now, in the \textbf{Text
                     25: Block}, put {}``What is \$a plus \$b?'', and in the \textbf{Answer} put
                     26: {}``\$answer'', without the quotes for either of them. (It is a good idea
                     27: to create a variable to hold the answer and call it \$answer, or some other
                     28: reasonably standard name. Do not try to compute the answer in the \textbf{Answer}
                     29: field itself; it will not work as you expect.) Now save the problem and \textbf{View}
                     30: it. You'll see a randomized problem.
                     31: 
                     32: For each student, the same random number will be used each time they visit
                     33: the problem, but each student will get different random numbers. For any
                     34: but the simplest random problems, you'll want to see several random problems
                     35: to make sure everything is working out correctly. This is what the \textbf{Random
                     36: Seed\index{Random Seed}} field is for. To see another randomized version
                     37: of the problem you've just created, put another number into the \textbf{Random
                     38: Seed} field and hit \textbf{Change}. It doesn't really matter what number
                     39: you put into the field. But for any given \textbf{Random Seed} with the same
                     40: problem, you'll see the same randomized problem generated for you. (If you
                     41: change the \textbf{Script}, you are no longer guaranteed to get the same
                     42: problem.) 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>