トピック
Taylor monovae1324

biased randomness

so if you want to generate "random" numbers but want one number to appear more often, you need modular division. say I have 0,1,2 and I want 0 the most. what I do is take rnd(4), which gives me 0,1,2,3. now if I take (rnd(4) mod 3), I get 0,1,2,0. the 0 now shows up twice as much as the others. rest in comments
2そうだね
プレイ済み
返信[1]
親投稿
Taylor monovae1324
you can stack this for better results. (((rnd(6) mod 5) mod 4) mod 3) yields 4 times as many zeroes as 1s or 2s. if you want the emphasis on 1 or 2 instead, just raise values to 1,2,3 or 2,3,4 and then use if A>2 then A=A-3
0そうだね
プレイ済み
返信[2]
親投稿
Aaron Krondelo
I have developed a system for controlling distribution ranges through random dice rolls. Easiest to make is a bell curve so the middle value occurs most frequently. I may have to share this.
0そうだね
プレイ済み
返信[3]
親投稿
Oscar PwnageBlock
Nice methods! When I need numbers to appear more frequently, I usually just go the easy way and distribute a random number among certain ranges. So it would look something like this... R=RND(100) IF R<20 THEN 'SMTH1 ELSEIF R<50 THEN 'SMTH2 ELSE 'SMTH3 ENDIF
2そうだね
プレイ済み
返信[4]
親投稿
SıмΞоп SimeonW
Oh! Oh! I know this one Took forever to find it on stackoverflow Mkay So you want a bell curve with 0.5 most often, and near 0 or 1 to be rarer This is how (RND()+RND())/2 for a little bit of focus on 0.5 (RND()+RND()+RND())/3 for more focus on 0.5 (RND()+RND()+RND()+RND())/4 for more focus on 0.5 and near 1 or 0 to be way way more rare ...and so on
0そうだね
プレイ済み
返信[5]
親投稿
SıмΞоп SimeonW
I meant RNDF() not RND(), RNDF() allows decimal values Anyways here's a demo It features a quick and simple BELL(N) function made to replace the RNDF() function, and it basically allows you to select the amount of focus on 0.5, while it is still completely possible to get a value near 0 or 1, its just extremely rare
1そうだね
プレイ済み
返信[6]
親投稿
SıмΞоп SimeonW
And here's the output, which as you can see shows that the middle of the screen (0.5) is the most common place for a dot to be, and if you increase the number inside the BELL() function then you can make getting a value near either edge of the screen to be EXTREMELY rare, and we're talking about 1 in a million for BELL(80)
2そうだね
プレイ済み
返信[7]
親投稿
SıмΞоп SimeonW
Histogram view
2そうだね
プレイ済み