summaryrefslogtreecommitdiffstats
path: root/gl/modules/randperm
AgeCommit message (Collapse)AuthorLines
2025-09-14maint: randperm: remove stale dependencyPádraig Brady-1/+0
* gl/modules/randperm: Remove assert-h dependency not required since commit v9.5-34-g26ba82015
2024-12-30maint: adjust to Gnulib module renamingPaul Eggert-1/+1
* bootstrap.conf, gl/modules/buffer-lcm, gl/modules/randperm: * gl/modules/randread, gl/modules/strnumcmp, gl/modules/targetdir: * gl/modules/xdectoint, gl/modules/xfts: Adjust to recent renaming of Gnulib modules, e.g., stdbool → bool, inttypes → inttypes-h.
2024-05-16maint: prefer stdbit.h to count-leading-zeros.hPaul Eggert-1/+1
<stdbit.h> is in C23 and should be more portable in the long run, now that Gnulib supports it. * bootstrap.conf (gnulib_modules): Remove count-leading-zeros. Add stdc_leading_zeros. * gl/lib/randperm.c, src/ioblksize.h: Include stdbit.h instead of count-leading-zeros.h. * gl/lib/randperm.c (floor_lg): Remove; no longer needed. (randperm_bound): Use stdc_bit_width instead of floor_lg; * gl/modules/randperm (Depends-on): Remove count-leading-zeros. Add stdc_bit_width. * src/ioblksize.h (io_blksize): Use stdc_leading_zeros_ull instead of count_leading_zeros_ll.
2022-09-15maint: prefer static_assert to verifyPaul Eggert-0/+1
* bootstrap.conf: Add assert-h. * gl/lib/randperm.c: Do not include verify.h. * gl/lib/randperm.c, src/basenc.c, src/dd.c, src/digest.c: * src/dircolors.c, src/expr.c, src/factor.c, src/ls.c, src/numfmt.c: * src/od.c, src/seq.c, src/shred.c, src/sort.c, src/stat.c: Prefer C23’s static_assert to nonstandard verify. * gl/modules/randperm (Depends-on): Add assert-h.
2019-10-22shuf: improve randperm overflow checkingPaul Eggert-0/+2
* gl/lib/randperm.c: Include randperm.h first, since it’s the API. Include stdint.h, count-leading-zeros.h, verify.h. (floor_lg): Rename from ceil_log (which was not actually implementing the ceiling!) and implement the floor using count_leading_zeros. (randperm_bound): Use floor_lg, not ceil_log. Use uintmax_t instead of size_t in case the size gets large on a 32-bit host. * gl/modules/randperm (Depends-on): Add count-leading-zeros, stdint.
2011-12-03maint: add missing ":" after "License" in local gnulib module filesJim Meyering-1/+1
This avoids spurious diagnostics when running our "bootstrap" script. * gl/modules/heap: Append colon after "License". * gl/modules/randint: Likewise. * gl/modules/randperm: Likewise. * gl/modules/randread: Likewise. Reported by Stefano Lattarini. Diagnosed by Bruno Haible.
2011-05-14shuf: use memory more efficiently when returning a subsetPádraig Brady-0/+1
* gl/lib/randperm.c (randperm_new): When the number of items to return H, is much smaller than the total number of items N, use a hash to represent the sparse permutations of the set N. This is currently enabled for N > 128K and N/H > 32. * tests/misc/shuf: Ensure shuf can quickly return 2 numbers from a large range. * gl/modules/randperm: Depend on hash. * NEWS: Mention the change.
2007-10-07Convert coreutils' rand*.{c,h,m4} into modules.Jim Meyering-0/+24
First step: move these files to gl/lib: * lib/rand-isaac.c, lib/rand-isaac.h * lib/randint.c, lib/randint.h * lib/randperm.c, lib/randperm.h * lib/randread.c, lib/randread.h Step 2: add modules/rand* and remove now-unneeded .m4 files. * gl/modules/randint: New file. * gl/modules/randperm: New file. * gl/modules/randread: New file. * m4/randint.m4: Remove file. * m4/randperm.m4: Remove file. * m4/randread.m4: Remove file. Step 3: use the new modules * bootstrap.conf (gnulib_modules): Add randint and randperm. * m4/prereq.m4 (gl_RANDINT, gl_RANDREAD, gl_RANDPERM): Don't require; These have been removed. (gl_ROOT_DEV_INO): Don't require; already handled via bootstrap.conf.