Announcement

Collapse
No announcement yet.

Why I have different results?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Why I have different results?

    I have two BP's which subdivide a line to pieces with random size.

    This one return wrong result:
    Click image for larger version

Name:	BP_SubdTrk_bf_1.png
Views:	2
Size:	643.7 KB
ID:	1191724

    Here I just separate everything to functions:
    Click image for larger version

Name:	BP_SubdTrk2.png
Views:	1
Size:	712.4 KB
ID:	1191725

    What the reason? Why in the same calculation I got different results?

    #2
    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.

    Comment


      #3
      Originally posted by sylvain_l View Post
      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.
      Oh, it easy to explain I wanna subdivide a 'line' let say on few piece with a different size, here how is this algorithm works:
      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 1-5 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
      As you can see ORIGINAL VALUE and ARRAY VAL TOTAL is equal

      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 algorithm
      Last edited by MisaGu; 08-22-2016, 07:24 AM.

      Comment


        #4
        Originally posted by MisaGu View Post
        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 algorithm
        ok I understand what your code's doing. And what do you mean, by not guetting same result

        I know from where it should comes, but not really good at explaining it.
        BP works with float. I guess just round-off error with the decimal floating-point ( 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


          #5
          Originally posted by sylvain_l View Post
          And what do you mean, by not guetting same result
          As u can see I have two different implementation of this algorithm:
          - 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 fine
          Last edited by MisaGu; 08-22-2016, 11:16 AM.

          Comment


            #6
            I wasn't wrong when I pointed the rand function, but not for the reason I thought.

            you have to pin out from your rand function, meaning it run a different random number for those two. Store the output in a var, so you use the same number in your array and to substract from length.

            Comment


              #7
              but not for the reason I thought.


              I'll try to do what u said))

              Comment


                #8
                Thank u much for your help, it's works, I still a little confuse why is working by this way but i'll get it by my own - thank u!!!

                Comment


                  #9
                  This is pretty much me most of the time...

                  Click image for larger version

Name:	x0ml8.png
Views:	1
Size:	214.7 KB
ID:	1114262

                  Comment

                  Working...
                  X