Use floor(random(0,Dictionary.KeyCount)) or floor(int(random(0,Dictionary.KeyCount))) instead and see what happens.
Are you sure the dictionary is well filled and the keyCount is returning a valid value?
Again,
I want to understad Why "random" is not working without floor. My first think is because the "random" use decimal value, isn't it ?
Thank you to help me to understand better my error.