
Aug 3rd, 2019, 06:43 AM
#1
Thread Starter
Junior Member
Fill x Numbers with Random numbers
hi, first would like to say am glad there are still active members and forum on VB6
ok, here is what i like to ask  i hv a value(100) and would like to fill it All into an array(of 30). their range should be in between 1 to 6 each and total up 100 after filling all of them.
i hv try my it on my own, but it will either not reach 100 or exceed 100 :/
For i = 0 To 29
intRandom(i) = RandomNumber(6, 1)
Next
thanks in advance.

Aug 3rd, 2019, 07:38 AM
#2
Re: Fill x Numbers with Random numbers
I think you are asking that when the 30 numbers (random) are added up, they need to equal 100, correct?

Aug 3rd, 2019, 08:10 AM
#3
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
Originally Posted by SamOscarBrown
I think you are asking that when the 30 numbers (random) are added up, they need to equal 100, correct?
yes,they need to be 30 arrays with random numbers from 1 to 6. and when all 30 is fillup, they are equal to 100.

Aug 3rd, 2019, 08:26 AM
#4
Re: Fill x Numbers with Random numbers
Whew....that is an interesting challenge, especially how those 30 values are RANDOM. If you don't get help on this today, I may see if I can get the gray matter moving and attempt a solution. Interesting.

Aug 3rd, 2019, 08:27 AM
#5
Re: Fill x Numbers with Random numbers
All your current code is doing is 'hoping' that your 30 random numbers add up to 100. I think you need to put a bit more thought into it, have another try, and then ask for help when you get stuck.
If you don't know where you're going, any road will take you there...
My VB6 lovechildren: VeeHive and VeeLauncher

Aug 3rd, 2019, 08:37 AM
#6
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
Originally Posted by ColinE66
All your current code is doing is 'hoping' that your 30 random numbers add up to 100. I think you need to put a bit more thought into it, have another try, and then ask for help when you get stuck.
well, i hv try many times and i believe could be done in a better way and there should be some example online. my idea is to fill up few then minus the 100 from the total filled and maybe adjust the random range(less than 6 as max value) and so on to fill all of them. but with that way, the lower array will be less than the top making it not evenly spread.
thanks,

Aug 3rd, 2019, 08:47 AM
#7
Re: Fill x Numbers with Random numbers
Well that's pretty much what you'll have to do because what you are asking is not possible; you can't have 30 random numbers adding up to 100 unless you get lucky! Therefore you'll have to influence the outcome in some way. Show us your code for that...
If you don't know where you're going, any road will take you there...
My VB6 lovechildren: VeeHive and VeeLauncher

Aug 3rd, 2019, 08:53 AM
#8
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
Originally Posted by ColinE66
Well that's pretty much what you'll have to do because what you are asking is not possible; you can't have 30 random numbers adding up to 100 unless you get lucky! Therefore you'll have to influence the outcome in some way. Show us your code for that...
well, i dont hv that now as hv delete them since its 'not working'. the other way i think it to 'cheat' by using few manual template(30 arrays that total 100) and randomly select one, and shuffle them.
thanks,

Aug 3rd, 2019, 09:47 AM
#9
Re: Fill x Numbers with Random numbers
Let me suggest an algorithm.
1. Fill the 30 array items with 3s (number three) so that they all add up to 100. Wait, this is 90! Ok, put 10 fours so that Sum(A[i], i:=1 to 30) = 100
2. Generate a random value V from 1 to 6
3. Generate two random indexes I and J from 0 to 29
4. Add V to A[I] and substract V from A[J]
5. Iterate this 30 * 30 times (hint, array size, hint)
6. You have an array of random numbers that add up to 100
7. Postprocess A so that values are within 1 to 6 range
Last step 7. I'll leave it to you to figure it out :))
cheers,
</wqw>

Aug 3rd, 2019, 09:56 AM
#10
Re: Fill x Numbers with Random numbers
Ok, just seeing this. First, and foremost, 30 numbers ranging from 1 to 6 that sum to 100 will never be Uniform Random (which is what I believe you're suggesting). They can be Skewed Random, which pulls us into an entirely different area. For a set number of integers (say 30) with a specific range (say 1 to 6) to have a Uniform Random distribution, the midpoint of the range (3.5) times the number of integers (30) must equal the total your after ... and 3.5 times 30 = 105 (not 100).
Therefore, if you're truly wanting what you suggest, the first order of business is to figure out from which skewed distribution you're pulling your random number: Poisson, Gauss with a skew value, logarithmic, etc. There are many to choose from. Possibly you even want to bracket part of one of those skewed curves. And, from there, you can start devising your algorithm to always sum to a specific value.
Also, you will need to decide if the Rnd function is good enough for you, or whether you wish to use the more robust CryptGenRandom (or other) API call (where you get more robust random numbers). And, again, in any of those cases, the results will need to be transformed such that they come from your skewed distribution.

Dealing with random numbers is never as straightforward as people think. And when you want them from a skewed distribution, it gets even more complex.
Good Luck,
Elroy

EDIT1: WOW, it took me 30 minutes to make that post ... ran into one of those weird character combinations that wouldn't let me make the post. The bad word filters here apparently really get sideways at times.
EDIT2: Just as an FYI, pretty much all randomtype functions (Rnd, CryptGenRandom, etc) assume that Uniform Random distribution, within their defined range.
Last edited by Elroy; Aug 3rd, 2019 at 10:01 AM.
Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will reattach those licenses and/or attributions. To all, peace and happiness.

Aug 3rd, 2019, 10:25 AM
#11
Re: Fill x Numbers with Random numbers
Another option to build your skewed distribution would be to define the skew proportions for each of your values. For instance, you have stated you want integers from 1 to 6 and you want 30 of them to sum to 100. We could use this information to back into what we want.
For instance, first, we know we want a mean of 3.33... (100 / 30). That will always be true regardless of the actual numbers, because the mean = total/n, which is 100/30.
From there, we must assign proportions to each of our allowed numbers (1 to 6) such that their weighted proportions sum to 3.33.... Unweighted proportions (i.e., a Uniform Distribution) will sum to 3.5, as follows:
Code:
Number Proportion Product
1 .16666... .16666...
2 .16666... .33333...
3 .16666... .5
4 .16666... .66666...
5 .16666... .83333...
6 .16666... 1.0
Sum of proportion products = 3.5 (not 3.33....)
Therefore, we must come up with a set of proportions which sum of proportion products = 3.33....
The easiest way is to just tamper with the most influential (the 6). We know that 3.5  3.33... = .166...
Therefore, we could just do a bit of algebra, shaving .1666 from 1.0, and then back into the proportion for 6:
1.0  .166... = .8333...
.8333 / 6 = .138888...
Therefore, if we make .13888... for our proportion for 6, our problem is solved:
Code:
Number Proportion Product
1 .16666... .16666...
2 .16666... .33333...
3 .16666... .5
4 .16666... .66666...
5 .16666... .83333...
6 .13888... .83333...
Sum of proportion products = 3.33...
From there, we could use Rnd (or CryptGenRandom) and generate 30 random numbers from 1 to 6 that summed to 100. We'd know going in that the value of 6 would be skewed (occurring slightly less frequently than the others), but, with a bit of thought we could get to where we wanted to be.

Just one idea for how to simply skew a distribution.
Elroy

EDIT1: I think this part is obvious, but maybe not. Even after implementing our skew in the random numbers, we'd still have work to guarantee they summed to 100 each time. Alternatively, we could implement our skew, and just take the 30 numbers we got. They wouldn't necessarily sum to 100 each time, but, over the longrun, the average sum would be 100 (if we implemented the skew correctly). QED.
EDIT2: FYI, this really isn't a VB6 questions. It's more of a straightforward random number theory question.
Last edited by Elroy; Aug 3rd, 2019 at 10:39 AM.
Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will reattach those licenses and/or attributions. To all, peace and happiness.

Aug 3rd, 2019, 10:46 AM
#12
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
@wqweto @Elroy thanks alot for the info, will check out CryptGenRandom later. not as i will need it as i dont need a real RNG, just like to learn something new
both your suggestion is good, but very complex, so i actually did what i mention earlier  make few fix template put them in DB, random to select which template to use, and then randomly shuffle them.
i understand this is 'cheating', but its ok as long a cat can catch a mouse, its a good cat ;p
thanks everyone (y)

Aug 3rd, 2019, 10:55 AM
#13
Re: Fill x Numbers with Random numbers
Just recognize that, with a template (table) you shuffle, you will always have the same number of 1s, 2s, 3s, etc. Also, as I outlined, your distribution will always have a bit of skew built into it (probably a few less 6s, just because that's the easiest way to get your sum to 100, and not 105).
Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will reattach those licenses and/or attributions. To all, peace and happiness.

Aug 3rd, 2019, 11:02 AM
#14
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
Originally Posted by Elroy
Just recognize that, with a template (table) you shuffle, you will always have the same number of 1s, 2s, 3s, etc. Also, as I outlined, your distribution will always have a bit of skew built into it (probably a few less 6s, just because that's the easiest way to get your sum to 100, and not 105).
hi, skew is ok as long its not skew at top(mid or bottom) every time. with the method mention it looks very natural to a normal user.
thanks,

Aug 3rd, 2019, 11:11 AM
#15
Re: Fill x Numbers with Random numbers
Originally Posted by aboka
hi, skew is ok as long its not skew at top(mid or bottom) every time.
Ohhh, to have the skew be different each time pushes you back into a very complex situation. I don't think I'll even go there. Just as a trivial example, you'd have to forego many more 1s than 6s to keep your sum at 100. So, how does that affect your skew? See? It's not straightforward.
Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will reattach those licenses and/or attributions. To all, peace and happiness.

Aug 3rd, 2019, 11:39 AM
#16
Re: Fill x Numbers with Random numbers
Here is a straighforward attempt
thinBasic Code:
Option Explicit Private Sub Form_Load() Randomize End Sub Private Sub Form_Click() Dim A(0 To 29) As Long FillArray A, 100 SuffleArray A, 1, 6, 30& * 30 * 30 DumpArray A End Sub Private Sub FillArray(A() As Long, ByVal TotalSum As Long) Dim lIdx As Long Dim lSum As Long For lIdx = 0 To UBound(A) A(lIdx) = Int((lIdx + 1) * TotalSum / (UBound(A) + 1)  lSum) lSum = lSum + A(lIdx) Next Debug.Assert lSum = TotalSum End Sub Private Sub SuffleArray(A() As Long, ByVal Min As Long, ByVal Max As Long, ByVal Iters As Long) Dim lIdx As Long Dim lJdx As Long Dim lVal As Long Do While Iters > 0 ' note: random index in 0 to UBound(A) interval w/o bias from Rounding lIdx = Int(Rnd * (UBound(A) + 1)) lJdx = Int(Rnd * (UBound(A) + 1)) lVal = A(lIdx)  1 If lVal > Max  A(lJdx) Then lVal = Max  A(lJdx) End If If lVal > 0 Then lVal = 1 + Int(Rnd * lVal) A(lIdx) = A(lIdx)  lVal A(lJdx) = A(lJdx) + lVal Iters = Iters  1 End If Loop End Sub Private Function DumpArray(A() As Long) As String Dim lIdx As Long Dim lSum As Long Dim C(0 To 255) As Long For lIdx = 0 To UBound(A) Debug.Print A(lIdx) & ", "; lSum = lSum + A(lIdx) C(A(lIdx)) = C(A(lIdx)) + 1 Next For lIdx = 1 To 6 Debug.Print "C" & lIdx & "=" & C(lIdx) & ", "; Next Debug.Print "Sum=" & lSum End Function
Only Elroy can tell what is the skew here though :))
cheers,
</wqw>
Last edited by wqweto; Aug 3rd, 2019 at 03:34 PM.

Aug 3rd, 2019, 11:49 AM
#17
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
Originally Posted by wqweto
Here is a straighforward attempt
thinBasic Code:
Option Explicit Private Sub Form_Load() Dim A(0 To 29) As Long Randomize FillArray A, 100 DumpArray A SuffleArray A, 1, 6, 30 * 30 DumpArray A End Sub Private Sub FillArray(A() As Long, ByVal TotalSum As Long) Dim lIdx As Long Dim lSum As Long For lIdx = 0 To UBound(A) A(lIdx) = Int((lIdx + 1) * TotalSum / (UBound(A) + 1)  lSum) lSum = lSum + A(lIdx) Next Debug.Assert lSum = TotalSum End Sub Private Sub SuffleArray(A() As Long, ByVal Min As Long, ByVal Max As Long, ByVal Iters As Long) Dim lIdx As Long Dim lJdx As Long Do While Iters > 0 ' note: random index in 0 to UBound(A) interval w/o bias from Rounding lIdx = Int(Rnd * (UBound(A) + 1)) lJdx = Int(Rnd * (UBound(A) + 1)) If A(lIdx) > Min And A(lJdx) < Max Then A(lIdx) = A(lIdx)  1 A(lJdx) = A(lJdx) + 1 Iters = Iters  1 End If Loop End Sub Private Function DumpArray(A() As Long) As String Dim lIdx As Long Dim lSum As Long For lIdx = 0 To UBound(A) Debug.Print A(lIdx) & ", "; lSum = lSum + A(lIdx) Next Debug.Print "Sum=" & lSum End Function
Only Elroy can tell what is the skew here though :))
cheers,
</wqw>
That would be the best method if its not because it show 'too many duplicates'(3,3,4....) 
3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, Sum=100
5, 5, 4, 6, 3, 3, 4, 1, 1, 3, 3, 6, 4, 2, 6, 5, 2, 2, 6, 3, 4, 2, 2, 2, 4, 3, 2, 2, 3, 2, Sum=100
3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, Sum=100
1, 2, 3, 4, 4, 3, 5, 5, 1, 5, 5, 5, 2, 1, 2, 3, 4, 4, 2, 4, 3, 5, 5, 1, 3, 2, 5, 2, 4, 5, Sum=100
3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, Sum=100
2, 5, 4, 5, 1, 6, 3, 1, 6, 4, 1, 5, 4, 4, 1, 3, 3, 1, 4, 4, 5, 3, 2, 2, 1, 2, 5, 2, 6, 5, Sum=100
Thanks for the try thou

Aug 3rd, 2019, 02:31 PM
#18
Re: Fill x Numbers with Random numbers
Quick stab: Basically adjusts the range of numbers that can be picked from based upon the current Running Average, so that it converges on 3.333. The final number is added 'manually' to make up the 100.
Code:
Private Sub Command1_Click()
Dim i As Long, ThisPick As Long, RunningTotal As Long, RunningAverage As Double, MinNum As Long, MaxNum As Long
MaxNum = 6
MinNum = 1
For i = 1 To 29
ThisPick = Int((MaxNum * Rnd) + MinNum)
RunningTotal = RunningTotal + ThisPick
RunningAverage = RunningTotal / i
Debug.Print "Picked " & ThisPick;
Debug.Print ": Running Total is " & RunningTotal & ", Running Average is " & RunningAverage;
If RunningAverage > 100 / 30 Then
Debug.Print ": We need to get the average down!";
MinNum = 1
MaxNum = MaxNum  1
If MaxNum < 0 Then MaxNum = 0
Else
Debug.Print ": We need to get the average up!";
MinNum = MinNum + 1
If MinNum > 6 Then MinNum = 6
MaxNum = 6  MinNum + 1
End If
Debug.Print "...Next time, pick from "; MinNum & " to " & MinNum + MaxNum  1
Next i
Debug.Print "The last number we need is a " & 100  RunningTotal
End Sub
A few test runs:
6,1,3,5,3,3,2,2,4,6,1,5,2,6,2,3,1,5,6,1,2,6,4,2,2,4,1,5,5, + 2 = 100
2,6,4,2,2,4,4,1,6,1,4,5,1,5,3,5,2,1,4,5,1,4,3,4,5,1,5,4,2, + 4 = 100
3,2,4,5,2,3,3,5,1,4,4,4,5,1,3,5,3,1,4,4,4,5,1,2,6,1,2,3,6, + 4 = 100
6,3,4,3,2,1,5,2,3,5,2,3,3,6,1,4,5,2,5,1,3,3,6,2,3,3,6,1,4, + 3 = 100
3,3,6,2,2,2,6,1,5,5,1,6,2,3,1,3,5,5,1,5,4,1,2,3,4,6,1,3,4, + 5 = 100
6,3,1,6,1,1,6,4,3,2,3,5,2,6,2,1,6,1,3,5,2,4,6,2,2,5,2,5,3, + 2 = 100
3,2,3,5,5,1,5,1,4,3,6,1,2,6,3,3,6,3,2,1,4,6,3,2,6,3,2,2,5, + 2 = 100
6,1,4,1,3,3,6,2,3,5,2,3,3,4,6,1,6,1,3,5,2,3,6,1,6,2,3,2,5, + 2 = 100
3,4,3,4,1,6,1,2,4,5,5,1,2,6,1,2,6,4,5,1,3,6,1,3,5,2,5,1,6, + 2 = 100
3,3,3,6,1,4,6,1,2,2,6,2,4,4,1,5,3,4,5,1,5,1,4,6,2,2,3,3,5, + 3 = 100
4,4,2,5,1,6,2,3,1,4,3,6,2,3,4,5,1,5,4,1,5,1,6,4,3,2,1,2,6, + 4 = 100
5,5,1,1,3,3,4,6,1,5,4,1,6,4,1,2,5,1,5,4,3,2,4,5,1,3,3,4,6, + 2 = 100
Last edited by ColinE66; Aug 3rd, 2019 at 02:55 PM.
Reason: Added a few sample runs...
If you don't know where you're going, any road will take you there...
My VB6 lovechildren: VeeHive and VeeLauncher

Aug 3rd, 2019, 03:36 PM
#19
Re: Fill x Numbers with Random numbers
Originally Posted by aboka
That would be the best method if its not because it show 'too many duplicates'(3,3,4....) 
3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, Sum=100
5, 5, 4, 6, 3, 3, 4, 1, 1, 3, 3, 6, 4, 2, 6, 5, 2, 2, 6, 3, 4, 2, 2, 2, 4, 3, 2, 2, 3, 2, Sum=100
3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, Sum=100
1, 2, 3, 4, 4, 3, 5, 5, 1, 5, 5, 5, 2, 1, 2, 3, 4, 4, 2, 4, 3, 5, 5, 1, 3, 2, 5, 2, 4, 5, Sum=100
3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4, Sum=100
2, 5, 4, 5, 1, 6, 3, 1, 6, 4, 1, 5, 4, 4, 1, 3, 3, 1, 4, 4, 5, 3, 2, 2, 1, 2, 5, 2, 6, 5, Sum=100
Thanks for the try thou
Just edited the snippet above to increase the shuffle. Now its also dumping counts of 1s, 2s, etc. (stats) and it LGTM
Code:
1, 4, 4, 6, 2, 2, 4, 6, 5, 3, 4, 1, 4, 4, 6, 5, 1, 3, 1, 1, 4, 2, 1, 1, 3, 6, 3, 5, 2, 6, C1=7, C2=4, C3=4, C4=7, C5=3, C6=5, Sum=100
5, 2, 6, 6, 1, 6, 5, 6, 5, 3, 3, 6, 1, 1, 2, 1, 3, 4, 2, 1, 1, 1, 6, 3, 3, 4, 3, 4, 4, 2, C1=7, C2=4, C3=6, C4=4, C5=3, C6=6, Sum=100
6, 3, 6, 1, 3, 6, 3, 2, 3, 2, 1, 2, 3, 1, 4, 5, 4, 5, 5, 1, 6, 3, 4, 1, 2, 2, 2, 4, 4, 6, C1=5, C2=6, C3=6, C4=5, C5=3, C6=5, Sum=100
3, 1, 6, 4, 1, 1, 2, 5, 1, 1, 6, 2, 1, 1, 6, 6, 4, 6, 3, 1, 6, 2, 3, 1, 3, 6, 6, 2, 6, 4, C1=9, C2=4, C3=4, C4=3, C5=1, C6=9, Sum=100
Seems a little biased to 1s for no apparent reason. Probably still not exactly "fair' distribution.
cheers,
</wqw>

Aug 3rd, 2019, 03:54 PM
#20
Re: Fill x Numbers with Random numbers
Originally Posted by wqweto
Probably still not exactly "fair' distribution.
If the mean (average) of the range you're after (in this case, average of 1,2,3,4,5,6) times the N your after (in this case, 30) doesn't equal the total you're after, (in this case, 100), it's never going to be a "fair" (i.e., uniform, i.e., flat) distribution.
aboka, could set up some MonteCarlo trials and watch the distributions (along with percentages) for 1s, 2s, 3s, 4s, 5s, & 6s. This would be easy. Just set up an outer loop that kept pulling samples of 30 (which summed to 100) over and over, counting the 1s, 2s, 3s, 4s, 5s, & 6s each time, and figuring out the proportions of each one. Over time, the proportions, along with any bias, will become evident.
But, I'm unclear on how much any of this matters for aboka, so I'll leave it to him to perform this MonteCarlo test.
(I thought of linking the Wikipedia page for MonteCarlo Method, but it's too involved. Simply, the MonteCarlo method is doing something over and over and over (possibly 1000s or millions of times) and accumulating the results to see what happens. In some cases, this is easier to accomplish, although not strictly speaking a mathematical proof.)
Take Care,
Elroy
Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will reattach those licenses and/or attributions. To all, peace and happiness.

Aug 3rd, 2019, 11:59 PM
#21
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
thanks again Everyone for sharing your knowledge here

Aug 4th, 2019, 06:15 AM
#22
Re: Fill x Numbers with Random numbers
I'm glad I came back to visit this thread...tossing ideas around in my head while driving only came up with 'skewed' attempts. I wonder what this is for!!!!????

Aug 4th, 2019, 06:23 AM
#23
Thread Starter
Junior Member
Re: Fill x Numbers with Random numbers
Originally Posted by SamOscarBrown
I'm glad I came back to visit this thread...tossing ideas around in my head while driving only came up with 'skewed' attempts. I wonder what this is for!!!!????
im sure this is useful in many situations; as for me, its to distribute some data 'evenly' to the (30 users)
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
