There is no difference. The result of the evaluated expression will be the same either way you type it. Math.random() is going to return a floating point decimal between 0 and 1 (not including 1). That number will be multiplied by 4. This will result in a random floating point number between 0 and 3.9999999999999999.

In your first example, you then add 1 to the float making it between 1 and 4.9999999999999999. Math.floor() will then convert this float to highest integer that is less than the float. (Rounds down to the nearest whole number). That would give you 1, 2, 3 or 4.

In your second example, Math.floor() will convert the float returned by Math.random() to an integer value of 0, 1, 2 or 3, and then you add the 1, so you still end up with 1, 2, 3 or 4.

The randomness isn’t affected either way. Remember that for the result to be truly random, it is entirely possible to get the same number repeatedly. Every time Math.random() runs the chance for any outcome is the same as the chance for any other outcome.