Menu

first number in array is wrong

omsoq
2008-06-09
2012-09-26
  • omsoq

    omsoq - 2008-06-09

    Hello,
    I can post my whole program if this isn't clear, but it's kind of convoluted, so I wanted to check and see if this can get fixed easily first.
    What I'm doing is generating a bunch of random numbers and putting the first hundred into an array called delta_x and the second hundred into an array called delta_y.
    First I put 200 random numbers into an array called random_array, then I have this,

     for(i=0; i<100; i++){
              delta_x[i]=random_array[i];
              }
     for(i=100; i<200; i++){
                delta_y[i-100]=random_array[i];
                }
    

    Is there anything wrong with this notation in itself? I made a simple program that did this with a couple of small arrays and it worked, but something is wrong...
    Everything compiles and runs, as a whole, correctly, except that delta_x[0] is not the correct number (it's not a generated random number). So even though the rest runs correctly, it starts off wrong and messes it all up. :S
    If anyone sees a problem, let me know, or I can post everything.
    Thanks.

     
    • omsoq

      omsoq - 2008-06-09

      Never mind, I'm fine now.
      Sorry about the space...
      Thanks anway. :P

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.