Hi, Quoth Elie Le Vaillant <eolie...@disroot.org>: > Will do. I made some tweaks to the random functions which improve > them somewhat (better constants, no reentrant versions). I also > added an ifdef that uses arc4random on OpenBSD.
That seems nice. > > Maybe those aren't essential. The constants are objectively better > (they make the underlying LCG succeed more at spectral tests). > I think it's better to remove code we don't use, and we don't use > the reentrant versions. I'm not sure about arc4random, maybe it's > overkill? I think here we should try to think if we need a so good PRNG or we can live with normal random(). I think using things like arc4random makes more sense when you have to deal with crypto stuff, that as far as I know it is not our case. Saying that, I applied the first versions of your random functions but I was not very sure about them for the reasons that I commented before (and having less code is a good thing). > On a somewhat-related note, I have implementations for: > - realpath(1). Not POSIX, but present in most Linuxes and in > Net, Free and OpenBSD. > - shuf(1). Not POSIX, nor BSD, but it makes sense as the > alternative would be jot(1) from the BSDs, which I believe > would render seq(1) useless, and be overcomplicated. > Simplifies sort(1) (no -R flag), but also has a different > behavior on identical lines. > - tac(1). Not POSIX nor BSD, but coreutils and toy,busy-box. > Simplifies tail(1) and sort(1) (no -r flag for either). > - ts(1). Moreutils, toybox and OpenBSD have it. I believe it > can sometimes be useful. I would delay these until the sbase-ubase unification is done. We are very, very, very far to have a working branch, I am just clasifying things, and I can tell you that trying to compile anything in that branch will fail. Sadly, I don't have so much time as I had in the past, and I have to many projects to maintain, so I think the unification will take time. > I'm willing to work on a dc(1) implementation. Should I use > libzahl? That seems nice. I have a bc version almost finished that uses the classical bc-dc pipe. If you write dc then I can resume my work in bc and try to have it working with your dc version. I am not sure about using libzahl, because that would mean to have a dependency with libzahl and I am not sure about it. I would suggest you to read the original paper with the description of dc, where they explain very well how they implemented the original version, and it does not seem too complex. Regards,