日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

jvm延迟偏向_用于偏向硬币翻转模拟的Python程序

發布時間:2025/3/11 python 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jvm延迟偏向_用于偏向硬币翻转模拟的Python程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

jvm延遲偏向

Here, we will be simulating the occurrence coin face i.e. H - HEAD, T - TAIL. Simply we are going to use an inbuilt library called as random to call a random value from given set and thereby we can stimulate the occurrence value by storing the occurrence in the list ls of length 2 representing each face of the coin as ls[] represents the occurrence of:

在這里,我們將模擬出現的硬幣面,即H-HEAD,T-TAIL 。 簡單地講,我們將使用一個稱為random的內置庫從給定集合中調用隨機值,從而可以通過將出現的事件存儲在長度為2的列表ls中 (表示硬幣的每個面為ls []表示)來刺激出現值發生:

Here, we will be stimulating the occurrence of each dice face i.e. 1, 2, 3, 4, 4, 4, 5, 6, 6, 6, 6. Simply we are going to use an inbuilt library called as random to call a random value from given set and thereby we can stimulate the occurrence value by storing the occurrence in the list ls of length 6 representing each face of the dice as ls[4] represents the occurrence of face 5.

在這里,我們將刺激每個骰子面的出現,即1、2、3、4、4、4、5、6、6、6、6。簡單地說,我們將使用一個稱為random的內置庫來調用a給定集合中的隨機值,因此我們可以通過將出現次數存儲在代表骰子每個面的長度為6的列表ls中來刺激出現值,因為ls [4]代表面5的出現。

ls[0] - coin(H)ls[1] - coin(T)

Then using the library pylab, we can plot the value of each occurrence and can stimulate it.

然后,使用庫pylab ,我們可以繪制每個事件的值并進行刺激。

The deviation is clear that each of the faces i.e. heads and tails have an unequal probability of occurrence.

這種偏差很明顯,每個面(即頭和尾)的出現概率均不相等。

Program:

程序:

import random import pylab as pydef flip():return random.choice(['H','H','H','T','T','H','T'])ls = [0,0] chance = [104, 203, 302, 401, 505, 646, 756, 855, 985, 4565, 6565] for n in chance:for k in range(n):scr = flip()if scr == 'H':ls[0] = ls[0] + 4/4else:ls[1] = ls[1] + 4/4py.figure() py.plot(['H','T'], ls, 'bo') py.ylim(0,12300)print("HEADS: ", ls[0]) print("TAILS: ", ls[1])

Output

輸出量

翻譯自: https://www.includehelp.com/python/program-for-biased-coin-flipping-simulation.aspx

jvm延遲偏向

總結

以上是生活随笔為你收集整理的jvm延迟偏向_用于偏向硬币翻转模拟的Python程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。