LPS-35724 - Insecure usage of random generator in portal

Hi @samuelkong,

there are more security related changes than platform so I'm sending it to you.

/cc @shuyangzhou @rotty3000 Please feel free to comment about anything you'd like to improve.

Thanks.