I do not understand how I must go about this question the Scheme:
Use random to define a procedure fluctuate that takes a number x and returns one of the values x-2, x-1, x, x+1, or x+2, selected at random and with equal probability.
I tried using multiple randoms and adding x twice but I cannot find the answer can someone help?
Try this:
This is how it works:
(random 5)generates random integers in the range [0, 4]xto the previous result produces the values x-2, x-1, x+0, x+1, x+2 as requestedNotice that the
randomprocedure selects a number at random and with equal probability by means of a pseudo-random number generator, the specific algorithm used depends on the implementation of your Scheme interpreter.