Bug 239467 - [NEW PORT] sysutils/frand: Selects a random file from given directory.
Summary: [NEW PORT] sysutils/frand: Selects a random file from given directory.
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Rodrigo Osorio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-26 19:34 UTC by serpent7776
Modified: 2019-08-14 19:32 UTC (History)
1 user (show)

See Also:


Attachments
shar archive with port files (1.92 KB, text/plain)
2019-07-26 19:34 UTC, serpent7776
no flags Details
shar archive with updated descriptions (2.14 KB, text/plain)
2019-08-14 19:32 UTC, serpent7776
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description serpent7776 2019-07-26 19:34:49 UTC
Created attachment 206089 [details]
shar archive with port files

This is a small console utility that prints a random file name from given directory to standard output.
Comment 1 Rodrigo Osorio freebsd_committer 2019-07-29 10:23:13 UTC
Hi,

No offense, but what's the benefit of your tool compared to `find . -type f -maxdepth 1 | sort -R | head -n1` command line ?

The reservoir-sampling algorithm provide some benefits here ?

Regards,
-- rodrigo
Comment 2 serpent7776 2019-07-29 20:14:29 UTC
No offense taken. The reservoir-sampling algorithm will provide benefit for big directories, as it doesn't require sorting input data. For most cases find+sort will do just fine though.
I've created this port mainly for myself, so I can easily install this tool on my system. If you don't find this tool useful, I don't mind not including it is ports. I can always fallback to portshaker.
Comment 3 Rodrigo Osorio freebsd_committer 2019-08-08 13:37:45 UTC
At this points just two remarks:

The algorithm used (reservoir-sampling) should be notified
in the package description.

And you should add a few words about the benefits of this
solution in the long description aka pkg-descr.
Comment 4 serpent7776 2019-08-14 19:32:00 UTC
Created attachment 206553 [details]
shar archive with updated descriptions