golang 生成伪随机数

一、概述

golang 生成随机数可以使用系统自带的 math/rand 包。

二、使用方法

这种情况下产生的随机数都是相同的,如果需要不同的随机数需要这样:

或者

 

发表评论