# HP Forums

Full Version: HP Prime: RANDOM
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Good Morning,

From Home, Toolbox- Math- Probability - Random - Number sets up the RANDOM function which inputs two numbers and outputs a random number in between those two. Produces a display like

RANDOM(1,100) 99.2856397571

In CAS, the same sequence of key presses produces the display

RANDOM(1+100*i) 20.2759023826

I wonder what is the role of the "i" in RANDOM. That is, I did not input "i" to RANDOM, I typed RANDOM(1,100) but it displayed the line above.

Thanks!

RANDOM does not follow the same grammatical rule as "normal" functions for the CAS parser. You must write it without parenthesis RANDOM 1,100 or with parenthesis *outside* (RANDOM 1,100)

I see, thank you. But then, I wonder why the parenthesis come in when choosing RANDOM. that it's, the sequence of key presses above sets up RANDOM().

Quote:
Good Morning,

From Home, Toolbox- Math- Probability - Random - Number sets up the RANDOM function which inputs two numbers and outputs a random number in between those two. Produces a display like

RANDOM(1,100) 99.2856397571

In CAS, the same sequence of key presses produces the display

RANDOM(1+100*i) 20.2759023826

I wonder what is the role of the "i" in RANDOM. That is, I did not input "i" to RANDOM, I typed RANDOM(1,100) but it displayed the line above.

Thanks!

(a,b) is interpreted by the CAS parser to mean complex numbers. Ideally, though, RANDOM should have actually parsed RANDOM(1,100) "properly" and only assume a complex input when typing RANDOM((1,100)) -- we can only hope that they can find a way to do this for the next firmware.

I hope HP hears you. One unfortunate issue that this mismatch of notation causes is that "importing" is useless. It still works from Home to CAS, but it creates a messy instruction from CAS to Home.