Errr..wouldn't random(22)+1 only give you 21 of your frames?
random starts at zero meaning random(22)+1 is numbers,1-21.
also adding random int to ensure you get random whole numbers may be an idea,as not sure if not,getting a whole number would stop a frame change?.....but it may.
No, random(22)+1 will return 1-22
-> random(22) returns 0-21, 1 added results in 1-22
Also, random returns the same type that you pass. (I already explained it in another thread). If you pass a whole number then the return value is also an integer, if you pass a float, the return value will also be a float.