1*ce099b40Smartin /* $NetBSD: random.h,v 1.5 2008/04/28 20:23:04 martin Exp $ */ 25a6cac71Sross 3a6c28c44Sross /*- 4a6c28c44Sross * Copyright (c) 2001 The NetBSD Foundation, Inc. 5a6c28c44Sross * All rights reserved. 6a6c28c44Sross * 7a6c28c44Sross * This code is derived from software contributed to The NetBSD Foundation 8a6c28c44Sross * by Ross Harvey. 9a6c28c44Sross * 10a6c28c44Sross * Redistribution and use in source and binary forms, with or without 11a6c28c44Sross * modification, are permitted provided that the following conditions 12a6c28c44Sross * are met: 13a6c28c44Sross * 1. Redistributions of source code must retain the above copyright 14a6c28c44Sross * notice, this list of conditions and the following disclaimer. 15a6c28c44Sross * 2. Redistributions in binary form must reproduce the above copyright 16a6c28c44Sross * notice, this list of conditions and the following disclaimer in the 17a6c28c44Sross * documentation and/or other materials provided with the distribution. 18a6c28c44Sross * 19a6c28c44Sross * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20a6c28c44Sross * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21a6c28c44Sross * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22a6c28c44Sross * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23a6c28c44Sross * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24a6c28c44Sross * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25a6c28c44Sross * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26a6c28c44Sross * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27a6c28c44Sross * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28a6c28c44Sross * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29a6c28c44Sross * POSSIBILITY OF SUCH DAMAGE. 305a6cac71Sross */ 315a6cac71Sross 32a6c28c44Sross #ifndef RANDOM_H 33a6c28c44Sross #define RANDOM_H 345a6cac71Sross 35a6c28c44Sross #include <stdlib.h> 36a6c28c44Sross #include <inttypes.h> 37a6c28c44Sross 38a6c28c44Sross #include "milieu.h" 39a6c28c44Sross 40a41c3721Sross #define randomUint8() ((uint8_t)random()) 41a41c3721Sross #define randomUint16() ((uint16_t)random()) 42a41c3721Sross #define randomUint32() ((uint32_t)random()) 43a41c3721Sross #define randomUint64() ((uint64_t)random() << 32 | random()) 44a6c28c44Sross 45a6c28c44Sross #endif 46