NAME

kjb_pthread_read_prng_seeds - Read PRNG seeds for this thread

SYNOPSIS

#include "l_mt/l_mt_pthread.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 


int kjb_pthread_read_prng_seeds
(
	kjb_uint16 *s,
	size_t buf_length
);

DESCRIPTION

When called from a thread started with kjb_pthread_create, this writes the current state of the pseudo-random number generators (PRNGs) into the buffer indicated by input pointer 's' (which is expected not to equal NULL). Parameter 'buf_length' must indicate the number of cells (not bytes!) of the buffer, and if it is insufficient this returns ERROR. Depending on the size of the seeds, which we are deliberately leaving unspecified, this will write to locations s[0] up to s[buf_length-1] with the seed contents, but it will write less than that if buf_length exceeds the size of the seed containers. As stated, if buf_length is inadequate to hold all the seed bits, this function returns ERROR. This routine does NOT provide access to the seed bits of the primal thread of the main() function, a.k.a. thread zero. If this routine is called from thread zero, this returns ERROR. From any other thread, this returns the current seed bits of that thread, which we hope will be unique relative to the other threads and past and future calls. This routine is very low-level and not intended to be used except for library introspection and self-testing. To get repeatable random numbers from library code, you need only call set_random_options(), or kjb_seed_rand() and kjb_seed_rand_2(). The seeds for the subsequent threads are all derived from the kjb_rand_2() stream of thread zero. Informally, as of Fall 2013, the library uses two PRNGs each with 48 bits of state, and thus a buf_length of 6 is sufficient to hold all the seed bits. Future library revisions might change this. LOCK STATUS: yes, this locks/unlocks the thread_master_lock.

RETURNS

ERROR if unsuccessful, with a message; otherwise NO_ERROR.

RELATED

set_random_options, kjb_seed_rand, kjb_seed_rand_2, kjb_seed_rand_with_tod, kjb_seed_rand_2_with_tod, get_rand_seed

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Andrew Predoehl

DOCUMENTER

Andrew Predoehl

SEE ALSO

kjb_pthread_create , kjb_pthread_mutex_lock , kjb_pthread_mutex_trylock , kjb_pthread_mutex_unlock , kjb_pthread_equal , get_kjb_pthread_self , kjb_pthread_exit , kjb_pthread_join , kjb_pthread_cancel , kjb_pthread_mutex_init , kjb_pthread_mutex_destroy , kjb_multithread_wrapper_serialization_lock , kjb_multithread_wrapper_serialization_unlock , kjb_pthread_key_create , kjb_pthread_key_delete , kjb_pthread_setspecific , kjb_pthread_getspecific , kjb_pthread_once , kjb_pthread_attr_init , kjb_pthread_attr_destroy , kjb_pthread_attr_setdetachstate , kjb_pthread_attr_getdetachstate , get_kjb_pthread_number , reset_kjb_pthread_counter