The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
b00tyhunt3r

一个读取数据库再输出随机值的函数,重复 1000 次观察结果,怎么写效率最高?

  •  
  •   b00tyhunt3r · Nov 30, 2020 · 1615 views
    This topic created in 2066 days ago, the information mentioned may be changed or developed.

    大概的函数结构:

    首先函数内生成一个随机种子

    rand := lib_util_rand.NewRandom(uint64(time.Now().UnixNano()))

    然后读数据库再返回 A,B,C,D,E 五种结果。

    统计这 5 种结果出现的次数

    Go 语言

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5457 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:39 · PVG 15:39 · LAX 00:39 · JFK 03:39
    ♥ Do have faith in what you're doing.