Announcement
Collapse
No announcement yet.
Why I have different results?
Collapse
X

just one point that popup into my eye at first glance:
it's me or you are using a random float in range ^^
I don't understand how you excpect to get same result while using some randomness. (except if you ensure to force the seed and all the thing to kill the randomness)
sorry didn't look further that.

Originally posted by sylvain_l View Postjust one point that popup into my eye at first glance:
it's me or you are using a random float in range ^^
I don't understand how you excpect to get same result while using some randomness. (except if you ensure to force the seed and all the thing to kill the randomness)
sorry didn't look further that.
1. Take a number which I choosed for subdivision, 5 for example
2. Divide a line by this number (5)
3. Then when we get a result I choose randomly a number between 50% of this result and 150% of this result ( therefore if I got a 100 on step 2, I chosing random number between 50 and 150 )
4. Save random value to array.
5. After I got a random number, I subtract it from a 'line' value, save new value of the line and decrement a number of subdivisions by 1 ( will become 4,3,2,1 in this example )
6. Repeat 15 steps, until number of subdivisions will not be equal 1, then we just save value of the line to array
7. check that sum of values in array is equal to original value of line, which we had at the begin
In the end you will have an array with random values which in total will be equal your original value, used as a length of the line
Here is an example of the output:
LogBlueprintUserMessages: [LineSubdevision2_C_0] ORIGINAL VALUE: 2000.0
LogBlueprintUserMessages: [LineSubdevision2_C_0] Index: 0; Val: 517.648865
LogBlueprintUserMessages: [LineSubdevision2_C_0] Index: 1; Val: 431.270447
LogBlueprintUserMessages: [LineSubdevision2_C_0] Index: 2; Val: 286.039612
LogBlueprintUserMessages: [LineSubdevision2_C_0] Index: 3; Val: 417.221283
LogBlueprintUserMessages: [LineSubdevision2_C_0] Index: 4; Val: 347.819672
LogBlueprintUserMessages: [LineSubdevision2_C_0] ARRAY VALUES TOTAL: 2000.0
P.S.  sometimes result could be like that: 2000.000122, 1999.999878; but I don't think that it's much important, if it is you can just restart an algorithmLast edited by MisaGu; 08222016, 07:24 AM.
Comment

Originally posted by MisaGu View PostP.S.  sometimes result could be like that: 2000.000122, 1999.999878; but I don't think that it's much important, if it is you can just restart an algorithm
I know from where it should comes, but not really good at explaining it.
BP works with float. I guess just roundoff error with the decimal floatingpoint ( https://en.wikipedia.org/wiki/Decimal_floating_point ). (and also fact that computer use binary  in base 2 round number aren't the same that in base 10 )
Comment

Originally posted by sylvain_l View PostAnd what do you mean, by not guetting same result
 but the first one, return wrong result, the returned value even not nearly equal to original value, it could be less or more up to 60% difference!! (in my example it 2000, but output could be 900 or 2800 absolutely random.. )
 the second one works perfect as i want
What is bothering me, is that I do not understand why the first implementation of this algorithm return a wrong result... what the reason of this result??
Here my BP files: LineSubdevision.zip
P.S.  there is a two files: 'LineSubdivision' which return a wrong result and 'LineSubdevision2' which works fineLast edited by MisaGu; 08222016, 11:16 AM.
Comment
Comment