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.
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 ?
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.
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.
Created attachment 206553 [details]
shar archive with updated descriptions
A commit references this bug:
Date: Sun Aug 18 10:34:08 UTC 2019
New revision: 509198
Add new port sysutils/frand
frand is a command line tool who returns
a random file from a given directory using
the reservoir sampling algorithm.
With reservoir sampling algorithm, directory
contents doesn't need to be read in memory
then sorted and so will perform much better
than find+sort for directories with a large
amount of files.
Submitted by: email@example.com