Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^6: Random sampling a variable length file.

by bcrowell2 (Friar)
on Dec 26, 2009 at 22:14 UTC ( [id://814457]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Random sampling a variable length file.
in thread Random sampling a variable record-length file.

That's a good point, bobf. I think there are two possibilities.

(1) He only needs to get a random sample from this file once.

(2) He needs to get random samples from this file more than once, and needs each one to be random not only in and of itself but also in the sense of being uncorrelated with the other samples.

If it's #1, then I think it works to take a random byte position and then read the next record. If it's #2, then he can't use that method, and I think he clearly would be better off creating in index (or using the facilities of a database or filesystem).

  • Comment on Re^6: Random sampling a variable length file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://814457]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 19:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found