Hello, I am not a professional KM user, and if it possible, would you like to help me? thanks. I need to generate some random number and automaticly type it as a name for a file to save it somewhere
RAND(99) will give you a random integer from 0 to 98, not 0 to 99.
Therefore 1+RAND(99) will give you a number from 1 to 99. I don't think that's what the original poster wanted.
When you want a random integer from X to Y, you have the same problem. Let's say X was 100 and Y was 200. Then 200-100 gives you 100 and RAND(100) gives you a number from 0 to 99 but when you add 100 to that you get a number from 100 to 199 not 100 to 200. Do you see why people add one now?
The problem is entirely different if we are dealing with real numbers. The KM Function "RANDOM(A,B)" returns a REAL number from A to B. The documentation says it will never return B, but it's still all the way up to B. So you don't really need to add 1 in the case of RANDOM(100,200). But for an integer from 100 to 200 you would have to say RAND(200-100+1)+100.
P.S. Nobody seems to mind when people necro on this site. And I like that because sometimes it's the best way to deal with things, in my opinion.