gpt4 book ai didi

java - 生成随机 unix 时间戳

转载 作者:行者123 更新时间:2023-11-29 03:45:52 25 4
gpt4 key购买 nike

如何在特定时间生成随机 unix 时间戳。例如,获取今天和明天之间的随机 unix 时间平均值。

最佳答案

long randomEpoch = epoch1 + Math.abs(new Random().nextLong()) % (epoch2-epoch1);

其中 epoch1epoch2 是两次。

关于java - 生成随机 unix 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10951273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com