r.random is broken on the Mac at least. It jams all the points into the top edge of the screen instead of actually randomly distributing them. I thought this was fixed months back. If it was, it’s broken again and needs to be fixed for GRASS 6.2.
This happens with both vector and raster points, and both from the GUI and command line.
Michael
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
Works good on x86 GNU/Linux. (Ubuntu Edgy, GRASS 6.2.0RC1)
Maris.
On Thursday 28 September 2006 00:26, Michael Barton wrote:
r.random is broken on the Mac at least. It jams all the points into the top
edge of the screen instead of actually randomly distributing them. I
thought this was fixed months back. If it was, it¹s broken again and needs
to be fixed for GRASS 6.2.
This happens with both vector and raster points, and both from the GUI and
command line.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
r.random is broken on the Mac at least. It jams all the points into the top
edge of the screen instead of actually randomly distributing them. I thought
this was fixed months back. If it was, it¹s broken again and needs to be
fixed for GRASS 6.2.
This happens with both vector and raster points, and both from the GUI and
command line.
Probably because the "fix" tries to identify specific platforms rather
than testing the HAVE_DRAND48 macro:
I'm guessing that the OSX compiler doesn't define __APPLE__ any more.
In general: platform tests are a bad idea. Test the features which you
actually want to use. If you need a configure test, and don't know how
to write it yourself, make a request to the list.
I think it is just a Mac issue (maybe Windows too??)
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
From: Māris Nartišs <maris.gis@gmail.com>
Date: Thu, 28 Sep 2006 10:09:35 +0300
To: <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] r.random still broken on Mac
Works good on x86 GNU/Linux. (Ubuntu Edgy, GRASS 6.2.0RC1)
Maris.
On Thursday 28 September 2006 00:26, Michael Barton wrote:
r.random is broken on the Mac at least. It jams all the points into the top
edge of the screen instead of actually randomly distributing them. I
thought this was fixed months back. If it was, it¹s broken again and needs
to be fixed for GRASS 6.2.
This happens with both vector and raster points, and both from the GUI and
command line.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
__APPLE__ is still around. I don't think it'll go away. Handy little trick I found somewhere:
touch foo.h; cpp -dM foo.h
What was the problem before? is *rand48 broken on OS X? I see in my config.h that HAVE_DRAND48 is defined. Or that having drand48 doesn't mean there is lrand48?
If it's broken, I noticed that r.mapcalc's xrand.c also uses lrand48, but it still tests for HAVE_DRAND48 instead of __APPLE__. And it uses a different define for when HAVE_DRAND48 is not defined.
On Sep 28, 2006, at 12:20 PM, Glynn Clements wrote:
Michael Barton wrote:
r.random is broken on the Mac at least. It jams all the points into the top
edge of the screen instead of actually randomly distributing them. I thought
this was fixed months back. If it was, it¹s broken again and needs to be
fixed for GRASS 6.2.
This happens with both vector and raster points, and both from the GUI and
command line.
Probably because the "fix" tries to identify specific platforms rather
than testing the HAVE_DRAND48 macro:
I'm guessing that the OSX compiler doesn't define __APPLE__ any more.
In general: platform tests are a bad idea. Test the features which you
actually want to use. If you need a configure test, and don't know how
to write it yourself, make a request to the list.
I just did a quick test - removed __APPLE__ from r.random, so it uses the extern lrand48. I now get a random distribution.
On Sep 28, 2006, at 12:58 PM, William Kyngesburye wrote:
__APPLE__ is still around. I don't think it'll go away. Handy little trick I found somewhere:
touch foo.h; cpp -dM foo.h
What was the problem before? is *rand48 broken on OS X? I see in my config.h that HAVE_DRAND48 is defined. Or that having drand48 doesn't mean there is lrand48?
If it's broken, I noticed that r.mapcalc's xrand.c also uses lrand48, but it still tests for HAVE_DRAND48 instead of __APPLE__. And it uses a different define for when HAVE_DRAND48 is not defined.
On Sep 28, 2006, at 12:20 PM, Glynn Clements wrote:
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
From: William Kyngesburye <woklist@kyngchaos.com>
Reply-To: William Kyngesburye <kyngchaos@kyngchaos.com>
Date: Thu, 28 Sep 2006 13:41:07 -0500
To: Glynn Clements <glynn@gclements.plus.com>
Cc: Michael Barton <michael.barton@asu.edu>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] r.random still broken on Mac
I just did a quick test - removed __APPLE__ from r.random, so it uses
the extern lrand48. I now get a random distribution.
On Sep 28, 2006, at 12:58 PM, William Kyngesburye wrote:
__APPLE__ is still around. I don't think it'll go away. Handy
little trick I found somewhere:
touch foo.h; cpp -dM foo.h
What was the problem before? is *rand48 broken on OS X? I see in
my config.h that HAVE_DRAND48 is defined. Or that having drand48
doesn't mean there is lrand48?
If it's broken, I noticed that r.mapcalc's xrand.c also uses
lrand48, but it still tests for HAVE_DRAND48 instead of __APPLE__.
And it uses a different define for when HAVE_DRAND48 is not defined.
On Sep 28, 2006, at 12:20 PM, Glynn Clements wrote:
For the Mac builds, I can try to get these rebuilt and online Fri morning, but after that, the next 2 weeks I'm on vacation/traveling and will have minimal internet access.
On Sep 28, 2006, at 10:46 PM, Michael Barton wrote:
Thanks!
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
From: William Kyngesburye <woklist@kyngchaos.com>
Reply-To: William Kyngesburye <kyngchaos@kyngchaos.com>
Date: Thu, 28 Sep 2006 13:41:07 -0500
To: Glynn Clements <glynn@gclements.plus.com>
Cc: Michael Barton <michael.barton@asu.edu>, <grass-dev@grass.itc.it>
Subject: Re: [GRASS-dev] r.random still broken on Mac
I just did a quick test - removed __APPLE__ from r.random, so it uses
the extern lrand48. I now get a random distribution.
"Mon Dieu! but they are all alike. Cheating, murdering, lying, fighting, and all for things that the beasts of the jungle would not deign to possess - money to purchase the effeminate pleasures of weaklings. And yet withal bound down by silly customs that make them slaves to their unhappy lot while firm in the belief that they be the lords of creation enjoying the only real pleasures of existence…
>> I just did a quick test - removed __APPLE__ from r.random, so it uses
>> the extern lrand48. I now get a random distribution.
>
> So it's the fake lrand48() that's causing problems?
>
> Doh.
>
...
> Can you try this instead:
>
> #define lrand48() (((long) rand() ^ ((long) rand() << 16)) & 0x7FFFFFFF)
>
That works.
OK, I'll use that as the fallback.
So, was there some other reason to use the fake lrand48() on OS X,
since the real one seems to work?
Presumably it wasn't always available. It was originally only used for
Cygwin, but OSX was added in:
Also, note that lrand48() isn't available if you use -ansi unless you
specifically enable it with e.g. -D_SVID_SOURCE or -D_XOPEN_SOURCE.
This is part of the reason why platform tests should be avoided.