V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yang0327519  ›  全部回复第 1 页 / 共 1 页
回复总数  3
//创建并挂载虚拟磁盘
fallocate -l 10G t.img && mkfs.ext4 t.img && mkdir /tmp/TestMountPoint && mount -o loop t.img /tmp/TestMountPoint

//用完删除
umount /tmp/TestMountPoint && rm -f t.img
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   ·   实用小工具   ·   1896 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 16:34 · PVG 00:34 · LAX 09:34 · JFK 12:34
Developed with CodeLauncher
♥ Do have faith in what you're doing.