The simplest way is to run RNG (Random) (based on time or something dynamic) lets say from 1 - 100 then you can check if the number you got is less or equal to 1 put the word that you want to be with 1% chance etc... if you got another number bigger than 1 then put the word that has 99% of occurrence -> it is simplified.
however it might be not the best solution because random is not really random (but it is another problem ).
back to the original question
word1 -> 1% is <=1
word2 -> 40% is >1 && <= 40
word3 -> could be else