I'm building on the deriv2.Rnw question from the r-exams package, which includes num_to_schoice to randomize the answer options of a schoice question:
sc <- NULL
while(is.null(sc)) {
## parameters
a <- sample(2:9, 1)
b <- sample(seq(2, 4, 0.1), 1)
c <- sample(seq(0.6, 0.9, 0.01), 1)
## solution
res <- exp(b * c) * (a * c^(a-1) + b * c^a)
## schoice
err <- c(a * c^(a-1) * exp(b * c), a * c^(a-1) * exp(b * c) + c^a * exp(b * c))
rg <- if(res < 4) c(0.5, 5.5) else res * c(0.5, 1.5)
sc <- num_to_schoice(res, wrong = err, range = rg, delta = 0.1)
My intention is to enter text in the four or five answer options, in such a way that a result similar to the one in the attached image is obtained.