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

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

  •  
  •   b00tyhunt3r · Nov 30, 2020 · 1550 views
    This topic created in 2025 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   ·   2864 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:09 · PVG 23:09 · LAX 08:09 · JFK 11:09
    ♥ Do have faith in what you're doing.