我試圖隨機字符的出現在遊戲中,但用自己的名字作爲種子。所以,如果你以前遇到過「鮑勃」在比賽中,他永遠有相同的頭髮/眼睛等如何平滑隨機分佈?
現在我只是從生成的名稱中的數字(加入所有的字符代碼)和然後使用模數來決定他們擁有哪些選項。
實施例:Bob的種子是276(66 + 111 + 98)。 276%的髮型(40)的數量在36
這工作正常,但爲350+人的名單產生,分佈如下:
hair style: 0/# of people using it: 15
hair style: 1/# of people using it: 8
hair style: 2/# of people using it: 4
hair style: 3/# of people using it: 5
hair style: 4/# of people using it: 7
hair style: 5/# of people using it: 5
hair style: 6/# of people using it: 7
hair style: 7/# of people using it: 14
hair style: 8/# of people using it: 12
hair style: 9/# of people using it: 6
hair style: 10/# of people using it: 7
hair style: 11/# of people using it: 2
hair style: 12/# of people using it: 7
hair style: 13/# of people using it: 10
hair style: 14/# of people using it: 11
hair style: 15/# of people using it: 7
hair style: 16/# of people using it: 12
hair style: 17/# of people using it: 7
hair style: 18/# of people using it: 6
hair style: 19/# of people using it: 10
hair style: 20/# of people using it: 5
hair style: 21/# of people using it: 10
hair style: 22/# of people using it: 11
hair style: 23/# of people using it: 3
hair style: 24/# of people using it: 6
hair style: 25/# of people using it: 8
hair style: 26/# of people using it: 5
hair style: 27/# of people using it: 11
hair style: 28/# of people using it: 10
hair style: 29/# of people using it: 6
hair style: 30/# of people using it: 13
hair style: 31/# of people using it: 11
hair style: 32/# of people using it: 10
hair style: 33/# of people using it: 12
hair style: 34/# of people using it: 3
hair style: 35/# of people using it: 11
hair style: 36/# of people using it: 9
hair style: 37/# of people using it: 4
hair style: 38/# of people using it: 10
hair style: 39/# of people using it: 15
的分佈不是很順暢,它遍佈全球(不出所料)。我會碰到很多髮型#0的人,並且沒有髮型#11的人。
我怎樣才能順利完成這一出位?
你能補充頭髮樣式打造的髮型數量是素數? –
你必須讓同名的人擁有相同的髮型嗎?或者它是靈活的,只要你能找到一種方法來平滑分配? – Calpis