Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Dave Hawthorne <dave <at> jocom.com.au>
Subject: Re: problem: /dev/random is empty, perl can't get hash seed
Newsgroups: gmane.linux.distributions.gumstix.general
Date: Thursday 24th November 2005 04:22:28 UTC (over 11 years ago)
I wrote:

> Hi,
>
> I think this is a single problem, but might be wrong.

... and I was wrong. 

At least on my revision 649 build, perl produces the 'Your random 
numbers are not that random' message because it is using a broken 
library function (drand48()) to get floating-point PRNs.  In my gumstix 
build uClibc's drand48() seems to use the wrong floating point format, 
the first and second 32 bit halves were reversed.  This has something to 
do with the value of the flag __FLOAT_WORD_ORDER. 

This fault also rendered perl's rand() function useless.  It could be 
replicated with the following code cross-compiled for the GS:

#include 
#include 
int main(void) {
  for( i = 0; i < 10; i++ ) {
    printf("%f\n",drand48());
  }
    return 0;
}

I tried to change the setting in the uClibc build to fix my drand48() 
problem but got terribly tangled up. 
My shameful, quick work-around is to modify perl/config.sh as follows:

doublesize='8'
-drand01='drand48()'
+drand01='((double)lrand48())/2147483648.0'
drand48_r_proto='0'
dynamic_ext=''

And then rerun make in the perl buildroot directory. 

This fixes both my startup problem and rand() problem.  The lack of 
output from /dev/random doesn't seem to upset perl at all. 
John P, I hope this helps with your issues too.

Dave



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
 
CD: 854ms