https://docs.mendix.com/appstore/partner-solutions/ats/rg-one-random-number/
You can set the range of the randomnumber.
After this you have to merge the two.
Not sure but I think you need to set both variables to string.
If you have to convert int to str inplace you can use toString(var).
The built-in random() function gives you a random number >= 0.0 and < 1.0. So if you multiply this by 10 you should have a number >= 0.0 and < 10.0. If we floor() this we should get an integer between 0 and 9. We can turn this into a string, do the same operation again, and concatenate the results together. This should give you a two digit string you can then append to your UserID.
toString(floor(random() * 10)) + toString(floor(random() * 10))
https://docs.mendix.com/refguide/mathematical-function-calls/#5-random
https://docs.mendix.com/refguide/mathematical-function-calls/#6-floor
I hope this helps.
use java action custom, no input, just return to string
import java.util.Random;
public class GenerateRandomDigits {
public String executeAction() throws Exception {
Random random = new Random();
int digit1 = random.nextInt(10); // This generates a number between 0 and 9
int digit2 = random.nextInt(10); // This does the same for the second digit
String result = String.format("%d%d", digit1, digit2);
return result;
}
}