It is random. It is calculated from a hash of the user id, so without knowing the salt used, you'll not be able to work out when it will happen to any account. I think that sort of answers bitart's question in the OP as well. No, it isn't possible to tell if they would have ranked up if they had the merit.
Yeah, thanks, I've done some research (out of curiosity) about the activity count required.
Nah, that'd significantly complicate things. Currently this randomness is done with a single SQL query, which is very convenient.
activity>=775 and activity>=775+con_v(sub_str(sha_1(con_cat(ID_MEMBER,
secretSeed)), 1, 2), 16, 10)
The required activity level per user is suitably random for betting, but anyone who can read my code (there are a few such people) will be able to exactly predict when someone will become Legendary, so I don't really recommend it.
I've found somewhere that Theymos mentioned that the seed is the same for every user and SHA1 ensures that it can't be calculated backwards.
I've created a little database from the 'Legendary one day' thread where people were posting their activity when they became legendaries.
I've also created a little excel sheet that made the coding (the same in the SQL code above, it was not easy to get excel to do that for me, as excel don't know the SHA1, you need a visual basic extention for that).
Theymos was right, that's not possible to calculate it even if you have a decent database with user IDs and the matching activity count...
So to cut the long story short, I know that I need 430 merits still to become a legendary but I was just curious if somehow possible to 'predict' the necessary activity limit for the hero members, to check if it has already been reached.
Thanks to all
EDIT:
Sorry for altering the original SQL code (with several _ inserted into SQL commands), but cloudfare is blocking me if I quote the original SQL code from theymos's original post...