summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/random.c
Commit message (Collapse)AuthorAgeFilesLines
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-091-4/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Use 'uint32_t' instead of 'long' when a 32-bit integer is intended.David Schultz2004-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) Notes: svn path=/head/; revision=124738
* For type 0 rng lower initial drop to 50, it is enough to hide linearityAndrey A. Chernov2003-08-101-1/+5
| | | | | | | Reorganize historic #ifdef section Notes: svn path=/head/; revision=118731
* For rand(3) and random(3) TYPE_0 drop NSHUFF values right after srand{om}()Andrey A. Chernov2003-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. Notes: svn path=/head/; revision=110321
* Park & Miller PRNG can be safely initialized with any value but 0 and stuckAndrey A. Chernov2003-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. Notes: svn path=/head/; revision=110280
* Fix the style of the SCM ID's.David E. O'Brien2002-03-221-3/+2
| | | | | | | I believe have made all of libc .c's as consistent as possible. Notes: svn path=/head/; revision=92986
* Remove __P() usage.David E. O'Brien2002-03-211-1/+1
| | | | Notes: svn path=/head/; revision=92905
* Remove 'register' keyword.David E. O'Brien2002-03-211-11/+11
| | | | Notes: svn path=/head/; revision=92889
* Add a long-overdue nail to the deprecated /dev/urandom interfaceMark Murray2001-10-301-1/+1
| | | | | | | | by asking some things that need unpredictable numbers to read /dev/random instead. Notes: svn path=/head/; revision=85752
* urandom(4) -> random(4) in comments.Dima Dorfman2001-06-071-1/+1
| | | | | | | | | | PR: 27858 Submitted by: Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp> Reviewed by: md5(1) Approved by: markm Notes: svn path=/head/; revision=77851
* srand*dev() fallback code: change ^getpid() to ^(getpid() << 16) to allowAndrey A. Chernov2001-04-231-1/+1
| | | | | | | change of high word part too to produce more interesting seed distribution. Notes: svn path=/head/; revision=75862
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-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 Notes: svn path=/head/; revision=71579
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),Jason Evans2000-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 Notes: svn path=/head/; revision=56698
* Add three-tier symbol naming in support of POSIX thread cancellationJason Evans2000-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(). Notes: svn path=/head/; revision=55837
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* srandomdev: use stack junk value in the fallback code tooAndrey A. Chernov1997-06-151-2/+3
| | | | Notes: svn path=/head/; revision=26665
* Instead of copying fallback code over and over in each program,Andrey A. Chernov1997-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. Notes: svn path=/head/; revision=26624
* Remove orand* code as promised for the next releaseAndrey A. Chernov1997-03-291-8/+3
| | | | Notes: svn path=/head/; revision=24390
* Fix urandom reference in the commentAndrey A. Chernov1997-03-231-1/+1
| | | | Notes: svn path=/head/; revision=24154
* Add srandomdev() function (use "/dev/urandom" now)Andrey A. Chernov1997-03-231-0/+40
| | | | | | | Submitted by: wollman & me (add type casts and remove unneded loop) Notes: svn path=/head/; revision=24151
* Merge Lite2 changesPeter Wemm1997-03-111-30/+68
| | | | Notes: svn path=/head/; revision=23662
* Improve seeding, the random sequence did not vary matchAndrey A. Chernov1996-10-091-5/+55
| | | | | | | with the seed. Old variant will be available via libcompat soon. Notes: svn path=/head/; revision=18832
* Remove trailing whitespace.Rodney W. Grimes1995-05-301-3/+3
| | | | Notes: svn path=/head/; revision=8870
* u_int -> unsigned int, so that we don't have to include <sys/types.h>Bruce Evans1994-09-051-2/+2
| | | | | | | or depend on <stdio.h> bogusly including it. Notes: svn path=/head/; revision=2504
* BSD 4.4 Lite Lib SourcesRodney W. Grimes1994-05-271-0/+363
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=1573