Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<p>
One can use several random variables, with later randomizations depending on the values of earlier variables.
For example, in order to generate the random coefficients \a,\b of a quadratic polynomial \(x^2+ax+b) who always has two real roots, one can first generate a random integer \a, say, between -10,10. Then generate a random integer \b, say, between \(a^2/4-10) and \(a^2/4-1). Under OEF format, this can be written as
<pre>
\\integer{a=random(1..10)*random(-1,1)}
\\integer{b=floor(\\a^2/4)-random(1..10)}
</pre>
(where <tt>floor</tt> is the function returning the beggest integer \le its argument. Note also that here we have made a special randomization for \a in order to avoid the \link{degeneration}{degenerating} value 0.)
Another example is to generate 3 integers AB, BC, CA that DO NOT form the sides of a triangle. To do so, one can first generate two integers AB and BC, say, between 3 and 10. Then the third can be randomly taken beteen AB+BC+2 and AB+BC+10. Under OEF format, this is
<pre>
\\integer{AB=random(3..10)}
\\integer{BC=random(3..10)}
\\integer{CA=random(2..10)+\\AB+\\BC}
</pre>
Generated by GNU Enscript 1.6.5.90.