random.c (77851) | random.c (85752) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/lib/libc/stdlib/random.c 77851 2001-06-07 02:32:18Z dd $ | 33 * $FreeBSD: head/lib/libc/stdlib/random.c 85752 2001-10-30 21:26:50Z markm $ |
34 * 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; 39#endif /* LIBC_SCCS and not lint */ 40 41#include "namespace.h" --- 253 unchanged lines hidden (view full) --- 295 size_t len; 296 297 if (rand_type == TYPE_0) 298 len = sizeof state[0]; 299 else 300 len = rand_deg * sizeof state[0]; 301 302 done = 0; | 34 * 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; 39#endif /* LIBC_SCCS and not lint */ 40 41#include "namespace.h" --- 253 unchanged lines hidden (view full) --- 295 size_t len; 296 297 if (rand_type == TYPE_0) 298 len = sizeof state[0]; 299 else 300 len = rand_deg * sizeof state[0]; 301 302 done = 0; |
303 fd = _open("/dev/urandom", O_RDONLY, 0); | 303 fd = _open("/dev/random", O_RDONLY, 0); |
304 if (fd >= 0) { 305 if (_read(fd, (void *) state, len) == (ssize_t) len) 306 done = 1; 307 _close(fd); 308 } 309 310 if (!done) { 311 struct timeval tv; --- 185 unchanged lines hidden --- | 304 if (fd >= 0) { 305 if (_read(fd, (void *) state, len) == (ssize_t) len) 306 done = 1; 307 _close(fd); 308 } 309 310 if (!done) { 311 struct timeval tv; --- 185 unchanged lines hidden --- |