coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating pseudo-random integers


From: Melikamp T. Medley
Subject: Re: Generating pseudo-random integers
Date: Sat, 05 Feb 2011 00:42:20 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101213 Lightning/1.0b2 Lanikai/3.1.7

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks!

I think I want to write a utility that prints pseudo-random
integers (I have in CL, but I like it fast, so this time in C),
and link it with coreutils. I looked at Paul Eggert's work,
and I won't be able to do any better than that if I spend
years on it :) I want to print uniformly distributed integers
fast, formatted, in bulk if needed. And I want to call it roll.
Let me know if you have a word of advice.

On 02/04/2011 11:35 PM, Eric Blake wrote:
> Using just coreutils, though, I'm afraid your options are slim.  You
> could use 'seq 0 9 | sort -R | head -n1' (or use shuf instead of sort
> -R) to generate one random number at a time, but that gets expensive.
> Or, if you don't mind limiting yourself to 62**6 values (instead of the
> more traditional 2**32), you could do 'mkdir tmp; mktemp -u -p tmp
> XXXXXX'.  But that's the extent of coreutils' randomness exposed to the
> user.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJNTOM7AAoJED6BfG1n8l2BmGUP/R4DaaKfVG8XL7bxKWKo8+4K
IV/UmeFSmkcc68kFqtniir9TN7MQN2sXCwfEllYh4h9DUN8cHqNOIG18bD981E87
qCwDI6zaKa+p/PtyO82TS5qbZjcWUL5S+06TBEOgVAo5Iydbr56Mbj/N8fbBCxu1
ppmKS3stQNUEzeVXtxqBwPqe9O5e0z1gKXXXNb05nlKt5JWyYqbofoX3HvjPazyg
2+Bf8nVg5+tEssslToTVWr9TS72zZuBq43gOX4zxdY8oQEvOvLyR3Dbs2gZ7Tihy
Ds2dRKx4hgiRnLTtI9kk6BOntxf2bI4IoKIyeejr7dLxMg+6eeHUcCz/l9rvE8Jj
ixfkp9sCG9xep/GwW/b8HimHPAaqFVNB57VceTjJEeLhIs5K0aIok55oQvef8L0j
5MaqTl/ykvPC7l4h/xoOfBj3BAGwyEwI/sUWhVi/8CKMGPLSxE7IKqCot2YvSgVF
jXK6qev9BgYW+BnYJFK1tAPXSbUYxx+tNBj7xs/KGwr1m9XHzaJGZz40et5xMvIt
f/5sRvy+2auEzMa4D/vzBSVQ8/ThnikX7UTLkE/LWG14aifpTn3b75zWyVGC4Qna
kBvJzD1fOaTvrHQ1DJevk73ICW6uQgKAXLijWxxIrAku3q2eGI/Cu1dI5LqLTUQ6
mHrKkvbHSv6Nje6ijepk
=j6LK
-----END PGP SIGNATURE-----

Attachment: 0x67F25D81.asc
Description: application/pgp-keys


reply via email to

[Prev in Thread] Current Thread [Next in Thread]