首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
V2EX
›
yang0327519
›
全部回复第 1 页 / 共 1 页
回复总数
2
228 天前
回复了
dyllen
创建的主题
›
Go 编程语言
›
crypto/rand 生成的随机数可以编码成纯数字字符串吗?
package main
import (
"crypto/rand"
"fmt"
)
func main() {
n := 10 // 生成 10 个随机字节
buf := make([]byte, n)
_, err := rand.Read(buf)
if err != nil {
panic(err)
}
result := ""
for _, b := range buf {
result += fmt.Sprintf("%03d", b) // 将每个字节转换为三位数字的字符串
}
fmt.Println(result) // 输出纯数字字符串
}
2023-02-07 11:01:59 +08:00
回复了
From313
创建的主题
›
程序员
›
求一个高质量的 PDF 压缩方法啊
你需要的是这个吗
https://squoosh.app/
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
我们的愿景
·
实用小工具
·
1724 人在线
最高记录 6543
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms ·
UTC 00:40
·
PVG 08:40
·
LAX 17:40
·
JFK 20:40
Developed with
CodeLauncher
♥ Do have faith in what you're doing.