WeBWorK Problems

random command

random command

by erdem çekmez -
Number of replies: 2
Hi all,
ı am very new to webwork (this my first post) and ı want to learn how to write problems. I have been trying to understand the process by looking the codes of the existing problems but could not quite get how the random command works. For example what does random(2,9,1) mean. Indeed ı want to learn where should ı look to learn how this and other commands work?

In reply to erdem çekmez

Re: random command

by Danny Glin -
Turns out the random command is less well documented than I would have expected.  Here is a link to the documentation for it:

In short, it works as follows:
random(lower_limit, upper_limit, increment);

so random(2,9,1) would choose a random value between 2 and 9 (inclusive) going up by 1.

One of the best places to start learning to code WeBWorK problems would be:

You can start by looking at the three problems at the top to get a basic idea, and then you can look for specific techniques below.