logo
  • 教程列表
  • SO官方文档
  • 随机模块
    • 创建随机用户密码
    • 随机和序列随机选择和样本
    • 创建随机整数和浮动 randint randrange 随机和统一
    • 创建加密安全随机数
    • 可重复的随机数种子和状态
    • 随机二元决策
  1. StackOverflow 文档
  2. Python Language 教程
  3. 随机模块
  4. 随机二元决策

随机二元决策

Created: November-22, 2018

import random

probability = 0.3

if random.random() < probability:
    print("Decision with probability 0.3")
else:
    print("Decision with probability 0.7")
  • 可重复的随机数种子和状态

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明