git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 1/2] compat: add a mkstemps() compatibility function

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jun 2, 2009, 13:05 UTC
Message-ID
<4A252381.9000103@viscovery.net>
In-Reply-To
<e6cd6cf90906020535m24d588eau40b800555c9e906f@mail.gmail.com>
Antriksh Pany schrieb:
Show 9 quoted lines
> 2. tv_usec has a decimal value range of 0-999999  (10^6 usec make 1
> sec). Which means that tv_usec fits completely in 20 bits (or less).
> (tv_usec << 16) yields a number that fits completely in 36 bits (or
> less). Max value of this number is 999999 * 2^16, or for convenience,
> about M = 10^6 * 2^16. This number (in the range of 0 to M) goes on to
> be divided by D=62^6. Also, M > D. Thus, there is about a  D / M * 100
> ~ 87 % probability of the division M / D working out to be zero. i.e,
> in 87% cases, the last division (v/= num_letters) will cause 'v' to
> become 0.

But this value (after the 6th division, mind you) is not used. v is used the last time after the 5th division; at this time it still carries enough randomness: 62^5 < 2^32.

-- Hannes
Previous: Antriksh PanyNext: Antriksh Pany
Message 4 of 6 in “compat: add a mkstemps() compatibility function”
  1. 1/2 compat: add a mkstemps() compatibility functionDavid Aguilar, May 28, 2009
  2. 2/2 diff: generate prettier filenames when using GIT_EXTERNAL_DIFFDavid Aguilar, May 28, 2009
  3. Antriksh PanyJun 2, 2009
  4. Johannes SixtJun 2, 2009
  5. Antriksh PanyJun 3, 2009
  6. David AguilarJun 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.