```source("http://macosa.dima.unige.it/r.R")    # If I have not already loaded the library
---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
S 21 Random generator of exercises

# See here for "runif" and "set.seed".

# An example of how to use runif to randomly generate exercises

x=floor(runif(2,min=1,max=10)); cat(x[1]," x ",x[2], " = ?", "\n")
#4  x  7  = ?
x=floor(runif(2,min=1,max=10)); cat(x[1]," x ",x[2], " = ?", "\n")
#3  x  2  = ?

# I cannot foresee the output

# But if I use seet.seed with a given integer input, I can fix the order of generating
# the numbers

set.seed(2145); x=floor(runif(2,min=1,max=10)); cat(x[1]," x ",x[2], " = ?", "\n")
#7  x  5  = ?
set.seed(2145); x=floor(runif(2,min=1,max=10)); cat(x[1]," x ",x[2], " = ?", "\n")
#7  x  5  = ?
set.seed(41); x=floor(runif(2,min=1,max=10)); cat(x[1]," x ",x[2], " = ?", "\n")
#2  x  9  = ?
# ...

# Another example:
de = function(n) for (i in 1:3899) {if(as.roman(n)==i) print(i)}; ro = function(n) as.roman(n)
print("If x in Roman/decimal notation appears, translate x into dec./Roman. Check by typing 'r'")
n = floor(runif(1)*3899+1); if(runif(1)>0.5) {print(n);r = ro(n)} else {print(ro(n));r = n}
#223
r
#CCXXIII
set.seed(13)
n = floor(runif(1)*3899+1); if(runif(1)>0.5) {print(n);r = ro(n)} else {print(ro(n));r = n}
#MMDCCLXX
r
#2770
set.seed(13)
n = floor(runif(1)*3899+1); if(runif(1)>0.5) {print(n);r = ro(n)} else {print(ro(n));r = n}
#MMDCCLXX
# ...

# Another:

x <- 3+runif(1)*5+runif(10000)^(runif(1)+0.7)*(runif(1)+5)
BF=4; HF=1.5; statistic(x)
x <- 3+runif(1)*5+runif(10000)^(runif(1)+0.7)*(runif(1)+5)
BF=4; HF=1.5; statistic(x)

# If I use set.seed:

set.seed(153); x <- 3+runif(1)*5+runif(10000)^(runif(1)+0.7)*(runif(1)+5)
BF=4; HF=1.5; statistic(x)
set.seed(153); x <- 3+runif(1)*5+runif(10000)^(runif(1)+0.7)*(runif(1)+5)
BF=4; HF=1.5; statistic(x)            # the same exercise, specified by the "seed" 153

#
# This trick can be use by a person to practice and check the answers.
# It can be use by a teacher. He can prepare class-tests by putting at the beginning
# set.seed(N) with N different for the various pupils (and jotting down the various N).

Other examples of use

```