This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug manual/13595] New: missing details about how to use BSD random number function APIs
- From: "bruno at clisp dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Sat, 14 Jan 2012 17:18:43 +0000
- Subject: [Bug manual/13595] New: missing details about how to use BSD random number function APIs
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=13595
Bug #: 13595
Summary: missing details about how to use BSD random number
function APIs
Product: glibc
Version: 2.14
Status: NEW
Severity: normal
Priority: P2
Component: manual
AssignedTo: roland@gnu.org
ReportedBy: bruno@clisp.org
Classification: Unclassified
3 problems with the documentation, node "BSD Random",
title "BSD Random Number Functions":
1) The doc says that the prototype of the 'initstate' function is
void * initstate (unsigned int SEED, void *STATE, size_t SIZE)
But in reality, in <stdlib.h>, it is
char * initstate (unsigned int SEED, char *STATE, size_t SIZE)
2) It is unclear whether the function initstate() has to be called once
before the first call to random(). The doc should say whether it needs to
be called first or not.
3) It is unclear whether the function initstate_r() has to be called once,
to initialize a 'struct random_data', before the first call to random_r() on
this random-number generator. Also, it is unclear whether the memory area
of the 'struct random_data' has to be cleared first, using memset(), before
the first use of initstate_r() on it. Currently GNU recutils 1.5 uses the
initialization sequence
char random_state[128];
struct random_data random_data;
memset (&random_data, 0, sizeof (random_data));
initstate_r (time(NULL), (char *) &random_state, 128, &random_data);
The doc should say whether memset() is needed first, and whether initstate_r()
is needed then.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.