Optimize kernel part 1: Add frandom