summaryrefslogtreecommitdiff
path: root/glib/grand.h
Commit message (Collapse)AuthorAgeFilesLines
* #define __GLIB_H_INSIDE__ around including everything.Michael Natterer2008-05-051-1/+1
| | | | | | | | | | | | | | | | 2008-05-05 Michael Natterer <mitch@imendio.com> * glib/glib.h: #define __GLIB_H_INSIDE__ around including everything. * glib/*.h: check for that define instead of __G_LIB_H__ if G_DISABLE_SINGLE_INCLUDES is defined. * glib/gdatasetprivate.h: #include <glib.h> instead of <glib/gdataset.h> svn path=/trunk/; revision=6875
* make it possible to disable single-file includes by definingMichael Natterer2008-03-141-7/+5
| | | | | | | | | | | | | | | | | | 2008-03-14 Michael Natterer <mitch@imendio.com> * glib/*.h: make it possible to disable single-file includes by defining G_DISABLE_SINGLE_INCLUDES when building against GLib. Approved by Tim Janik. * glib/glib.h: include <glib/gslice.h>. * glib/gi18n.h * glib/gi18n-lib.h * glib/gprintf.h: include <glib.h> so the above works when these files are included without including <glib.h> first. svn path=/trunk/; revision=6713
* Add the init_by_array functionality from the reference implementation ofGeorge Lebl2004-01-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fri Dec 19 11:49:21 2003 George Lebl <jirka@5z.com> * glib/grand.c glib/grand.h (g_rand_new) (g_rand_new_with_seed) (g_rand_new_with_seed_array) (g_rand_set_seed_array): Add the init_by_array functionality from the reference implementation of the mersenne twister (mt19937ar.c) and change the naming to fit with the rest of the grand API. New functions are g_rand_new_with_seed_array, g_rand_set_seed_array. This is only reliable/tested for the 2.2 version of the seeding as that's what the reference implementation uses. Also modify g_rand_new to get 4 longs from /dev/urandom since that will always be available anyway and we get more entropy and if /dev/urandom is unavailable use also 4 longs for seeding using secs, usecs, getpid and getppid. For version 2.0 use only a simple seed again but be more careful about seeding with secs/usecs in this case. * glib/grand.c glib/grand.h (g_rand_copy): Add g_rand_copy function to copy the current state of the random number generator. * glib/grand.c (g_rand_new): Add testing for EINTR when reading from /dev/urandom * tests/rand-test.c: add testing of the array seeding stuff against the reference implementation, plus add statistical sanity check to see that the values outputted are truly kind of random. And check that g_rand_copy truly copies the state by checking a few terms.
* Trivial s/foo/foo_/ fixes to make <glib.h> includable with -WshadowSoeren Sandmann2002-11-081-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | Fri Nov 8 19:44:20 2002 Soeren Sandmann <sandmann@daimi.au.dk> * docs/reference/glib/tmpl/arrays.sgml: * docs/reference/glib/tmpl/arrays_byte.sgml: * docs/reference/glib/tmpl/arrays_pointer.sgml: * docs/reference/glib/tmpl/date.sgml: * docs/reference/glib/tmpl/linked_lists_double.sgml: * docs/reference/glib/tmpl/linked_lists_single.sgml: * docs/reference/glib/tmpl/main.sgml: * docs/reference/glib/tmpl/queue.sgml: * docs/reference/glib/tmpl/random_numbers.sgml: * docs/reference/glib/tmpl/relations.sgml: * docs/reference/glib/tmpl/scanner.sgml: * docs/reference/gobject/tmpl/gtype.sgml: * docs/reference/gobject/tmpl/value_arrays.sgml glib/garray.h: * glib/gdate.h glib/giochannel.h glib/glist.h glib/gmain.c: * glib/gmain.h glib/gqueue.c glib/gqueue.h glib/grand.c glib/grand.h: * glib/grel.h glib/gslist.h glib/gtimer.h gobject/gvaluearray.h: Trivial s/foo/foo_/ fixes to make <glib.h> includable with -Wshadow without warnings (#91680)
* Move glib library into a subdirectory, make all GLib include files includeOwen Taylor2001-06-261-1/+1
| | | | | | | | | | | | Tue Jun 26 11:43:46 2001 Owen Taylor <otaylor@redhat.com> * configure.in Makefile.am *.[ch] glib/*.[ch] glib/Makefile.am: Move glib library into a subdirectory, make all GLib include files include as <glib/glist.h> * tests/testglib.c tests/testgdate.c tests/testgdateparser.c tests/timeloop.c tests/timeloop-basic.c: Move all tests into the tests/ subdirectory.
* Fix to stupid bug in g_random_boolean, also both functions now return 1 orSebastian Wilhelmi2001-05-311-2/+2
| | | | | | | | 2001-05-31 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * grand.h (g_random_boolean, g_rand_boolean): Fix to stupid bug in g_random_boolean, also both functions now return 1 or 0 instead of 1<<15 or 0.
* Updated G_RAND_DOUBLE_TRANSFORM to be more accurate. Redid g_rand_double()Sebastian Wilhelmi2000-12-191-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 2000-12-19 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * grand.c: Updated G_RAND_DOUBLE_TRANSFORM to be more accurate. Redid g_rand_double() such that it returns 52 bits after the point instead of 32 as before. That OTOH requires calling g_rand_int() twice. Overhauled g_rand_int_range(), which is easier now thanks to the new precision of g_rand_double(). Thanks to Sverre Johansen <sj@ifi.uio.no> for the hint. * grand.h: Added g_rand_boolean() and g_random_boolean() macros. While they could be omitted due to extreme simplicity, they make intention clearer in code and are therefore good to have. * grand.c, grand.h: Renamed all 'min' and 'max' parameters to' begin' and 'end' resp. to avoid making people think, that 'max' is included in the interval. 'end' now isn't, whereas 'begin' is. That's similar to the use in the STL. * glib/glib-sections.txt: Added g_rand_boolean and g_random_boolean macros. * glib/tmpl/random_numbers.sgml: Updated.
* Split glib.h into many header files mostly according to the resp.Sebastian Wilhelmi2000-10-121-0/+76
2000-10-12 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib.h, galloca.h, garray.h, gasyncqueue.h, gbacktrace.h, gcache.h, gcompletion.h, gconvert.h, gdataset.h, gdate.h, ghash.h, ghook.h, giochannel.h, glist.h , gmacros.h, gmain.h, gmem.h, gmessages.h, gnode.h, gprimes.h, gquark.h, gqueue.h, grand.h, grel.h, gscanner.h, gslist.h, gstrfuncs.h, gstring.h, gthread.h, gthreadpool.h, gtimer.h, gtree.h, gtypes.h, gutils.h: Split glib.h into many header files mostly according to the resp. *.c-files. * gmacros.h: Added G_BEGIN_DECLS and G_END_DECLS to mean: 'in case of C++: extern "C" { ... }' analogous to glibc __BEGIN_DECLS and __END_DECLS. * configure.in, gerror.h, gfileutils.h, gshell.h, gspawn.h, gunicode.h, : Changed guard-macro names to something more consistent. * configure.in, *.h: Use G_BEGIN_DECLS and G_END_DECLS.