Anonymous | Login | 2024-04-18 11:59 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0000743 | [1003.1(2013)/Issue7+TC1] Base Definitions and Headers | Objection | Error | 2013-08-29 16:08 | 2019-06-10 08:55 | ||
Reporter | eblake | View Status | public | ||||
Assigned To | |||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | Eric Blake | ||||||
Organization | Red Hat | ||||||
User Reference | ebb.RAND_MAX | ||||||
Section | stdlib.h | ||||||
Page Number | 358 | ||||||
Line Number | 12038 | ||||||
Interp Status | --- | ||||||
Final Accepted Text | See Note: 0001836. | ||||||
Summary | 0000743: RAND_MAX should guarantee even distribution over a power of 2 | ||||||
Description |
The current definition of RAND_MAX is too weak to be easily useful. Random numbers are most useful if you can easily combine a small number of random bits into a larger random number; but for that to be easy, the random numbers need to be evenly distributed over a complete power-of-2 range. FreeBSD 10 recently experimented with changing RAND_MAX to be a non power-of-2 bitmask: http://lists.freebsd.org/pipermail/svn-src-head/2013-July/049068.html [^] with the result that it causes compilation failures in programs that had previously been able to exploit the fact that random numbers were evenly distributed over a power of 2 and could be concatenated: https://www.redhat.com/archives/libvir-list/2013-August/msg01546.html [^] There is a related XSI requirement that rand() have a period of at least 2**32 (line 56191), but there appears to be no requirement between the period of rand and the size of RAND_MAX (other than the implicit requirement that on a non-XSI system, a period of 2**16 would be permitted, and that RAND_MAX probably ought not to be larger than the period). |
||||||
Desired Action |
At page 358 line 12038 (XBD <stdlib.h> RAND_MAX), change: Maximum value returned by rand( ); at least 32 767. to Maximum value returned by rand( ); at least 32 767, and shall be one less than a power of two. |
||||||
Tags | tc2-2008 | ||||||
Attached Files | |||||||
|
Relationships | ||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2013-08-29 16:08 | eblake | New Issue | |
2013-08-29 16:08 | eblake | Name | => Eric Blake |
2013-08-29 16:08 | eblake | Organization | => Red Hat |
2013-08-29 16:08 | eblake | User Reference | => ebb.RAND_MAX |
2013-08-29 16:08 | eblake | Section | => stdlib.h |
2013-08-29 16:08 | eblake | Page Number | => 358 |
2013-08-29 16:08 | eblake | Line Number | => 12038 |
2013-08-29 16:08 | eblake | Interp Status | => --- |
2013-08-29 16:11 | eblake | Note Added: 0001772 | |
2013-08-29 16:11 | eblake | Tag Attached: c99 | |
2013-08-29 17:34 | dalias | Note Added: 0001774 | |
2013-08-29 17:43 | eblake | Note Added: 0001775 | |
2013-08-29 18:06 | dalias | Note Added: 0001776 | |
2013-08-29 18:49 | eblake | Note Added: 0001777 | |
2013-08-29 20:06 | philip-guenther | Note Added: 0001778 | |
2013-09-19 16:21 | Don Cragun | Note Added: 0001836 | |
2013-09-19 16:22 | Don Cragun | Note Edited: 0001836 | |
2013-09-19 16:23 | Don Cragun | Final Accepted Text | => See Note: 0001836. |
2013-09-19 16:23 | Don Cragun | Status | New => Resolved |
2013-09-19 16:23 | Don Cragun | Resolution | Open => Accepted As Marked |
2013-09-19 16:23 | Don Cragun | Tag Attached: tc2-2008 | |
2013-09-19 16:24 | Don Cragun | Tag Detached: c99 | |
2014-12-02 00:27 | eblake | Relationship added | related to 0000859 |
2019-06-10 08:55 | agadmin | Status | Resolved => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |