summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/random.c
Commit message (Collapse)AuthorAgeFilesLines
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* Use 'uint32_t' instead of 'long' when a 32-bit integer is intended.das2004-01-201-31/+32
| | | | | | | | | This results in no functional change, aside from fixing a data corruption bug on LP64 platforms. The code here could still use a significant amount of cleanup. PR: 56502 Submitted by: hrs (earlier version)
* For type 0 rng lower initial drop to 50, it is enough to hide linearityache2003-08-101-1/+5
| | | | Reorganize historic #ifdef section
* For rand(3) and random(3) TYPE_0 drop NSHUFF values right after srand{om}()ache2003-02-041-5/+8
| | | | | | | to remove part of seed -> 1st value correlation. Correlation still remains because of algorithm limits. Note that old algorithm have even stronger correlation, especially in the lower bits area, but not eye-visible, as current one.
* Park & Miller PRNG can be safely initialized with any value but 0 and stuckache2003-02-031-1/+4
| | | | | | | at 0 as designed. Its BSD adaptation tries to fight it by mapping 0 to 2147483647 after calculation, but this method not works since 2147483647 seed returns to 0 again on the next interation. Instead of after calculation mapping, map 0 to another value _before_ calculation, so it never stucks.
* Fix the style of the SCM ID's.obrien2002-03-221-3/+2
| | | | I believe have made all of libc .c's as consistent as possible.
* Remove __P() usage.obrien2002-03-211-1/+1
|
* Remove 'register' keyword.obrien2002-03-211-11/+11
|
* Add a long-overdue nail to the deprecated /dev/urandom interfacemarkm2001-10-301-1/+1
| | | | | by asking some things that need unpredictable numbers to read /dev/random instead.
* urandom(4) -> random(4) in comments.dd2001-06-071-1/+1
| | | | | | | PR: 27858 Submitted by: Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp> Reviewed by: md5(1) Approved by: markm
* srand*dev() fallback code: change ^getpid() to ^(getpid() << 16) to allowache2001-04-231-1/+1
| | | | change of high word part too to produce more interesting seed distribution.
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),jasone2000-01-271-3/+3
| | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen
* Add three-tier symbol naming in support of POSIX thread cancellationjasone2000-01-121-3/+3
| | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* srandomdev: use stack junk value in the fallback code tooache1997-06-151-2/+3
|
* Instead of copying fallback code over and over in each program,ache1997-06-141-9/+16
| | | | | | implement (better) falback code inside srandomdev() itself. Change return type from int to void (binary compatibility surprisely achieved). Userland code will be changed soon.
* Remove orand* code as promised for the next releaseache1997-03-291-8/+3
|
* Fix urandom reference in the commentache1997-03-231-1/+1
|
* Add srandomdev() function (use "/dev/urandom" now)ache1997-03-231-0/+40
| | | | Submitted by: wollman & me (add type casts and remove unneded loop)
* Merge Lite2 changespeter1997-03-111-30/+68
|
* Improve seeding, the random sequence did not vary matchache1996-10-091-5/+55
| | | | with the seed. Old variant will be available via libcompat soon.
* Remove trailing whitespace.rgrimes1995-05-301-3/+3
|
* u_int -> unsigned int, so that we don't have to include <sys/types.h>bde1994-09-051-2/+2
| | | | or depend on <stdio.h> bogusly including it.
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+363
OpenPOWER on IntegriCloud