Fix friendlist having a bad gray background

Thanks to toweI for reporting the issue
Fix #767
Rewrite horrible type casting pointer magic with shifts

Why would you generate that random number byte by byte, anyway ?