C# Random of cordinates is linear

Posted by Shawn Mclean on Stack Overflow See other posts from Stack Overflow or by Shawn Mclean
Published on 2010-04-25T08:50:52Z Indexed on 2010/04/25 8:53 UTC
Read the original article Hit count: 187

Filed under:

My code is to generate random cordinates of lat and long within a bound:

        Random lastLat = new Random();

        Random lastLon = new Random();

        for (int i = 0; i < 50; i++)
        {
            int lat = lastLat.Next(516400146, 630304598); //18.51640014679267 - 18.630304598192915

            int lon = lastLon.Next(224464416, 341194152); //-72.34119415283203 - -72.2244644165039

            SamplePostData d0 = new SamplePostData();
            d0.Location = new Location(Convert.ToDouble("18." + lat), Convert.ToDouble("-72." + lon));
            AddPushpin(d0);

        }

My output looks like this: http://img263.imageshack.us/img263/7504/capturerkv.png

Is there something wrong with how my numbers are generated?

© Stack Overflow or respective owner

Related posts about c#