前往内容

未分类
2023年6月25日

python randomly between two values?

作者 dikangqie

If you want a random integer values between -40 and +40, then

import random
random.randint(-40, 40)

If you want to choose either -40 or +40, then

import random
random.choice([-40, 40])

文章导航

上一篇文章上一篇 How can I display a Progressive JPEG in WPF?
下一篇文章下一个 How to get a random number between a float range?

近期文章

  • 教程:使用 ONNX 深度学习模型检测对象 – ML.NET | Microsoft Learn
  • ASP.NET Core MVC 项目 NLog
  • WPF MVVM框架—— Prism中配置NLog
  • C# – Realtime console output redirection
  • 自定义Marix的自定义动画,支持缓动动画属性

近期评论

  1. 一位WordPress评论者发表在世界,您好!

归档

  • 2024年1月
  • 2023年12月
  • 2023年11月
  • 2023年10月
  • 2023年9月
  • 2023年8月
  • 2023年7月
  • 2023年6月

分类

  • 未分类
自豪地采用 WordPress | 主题:Popularis Press