1110723Sseanc/* 2110723Sseanc * Copyright (C) 2003 Sean Chittenden <seanc@FreeBSD.org> 3110723Sseanc * All rights reserved. 4110723Sseanc * 5110723Sseanc * Redistribution and use in source and binary forms, with or without 6110723Sseanc * modification, are permitted provided that the following conditions 7110723Sseanc * are met: 8110723Sseanc * 1. Redistributions of source code must retain the above copyright 9110723Sseanc * notice, this list of conditions and the following disclaimer. 10110723Sseanc * 2. Redistributions in binary form must reproduce the above copyright 11110723Sseanc * notice, this list of conditions and the following disclaimer in the 12110723Sseanc * documentation and/or other materials provided with the distribution. 13110723Sseanc * 14110723Sseanc * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 15110723Sseanc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16110723Sseanc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17110723Sseanc * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 18110723Sseanc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19110723Sseanc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20110723Sseanc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21110723Sseanc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22110723Sseanc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23110723Sseanc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24110723Sseanc * SUCH DAMAGE. 25110723Sseanc * 26110723Sseanc * $FreeBSD: releng/10.2/games/random/randomize_fd.h 181527 2008-08-10 11:31:56Z ache $ 27110723Sseanc */ 28110723Sseanc 29110723Sseanc#ifndef __RANDOMIZE_FD__ 30110723Sseanc#define __RANDOMIZE_FD__ 31110723Sseanc 32181410Sache/* 33181410Sache * The random() function is defined to return values between 0 and 34181410Sache * 2^31 - 1 inclusive in random(3). 35181410Sache */ 36181527Sache#define RANDOM_MAX_PLUS1 0x80000000UL 37181410Sache 38110723Sseanc#define RANDOM_TYPE_UNSET 0 39110723Sseanc#define RANDOM_TYPE_LINES 1 40110723Sseanc#define RANDOM_TYPE_WORDS 2 41110723Sseanc 42110723Sseanc/* The multiple instance single integer key */ 43110723Sseancstruct rand_node { 44110723Sseanc u_char *cp; 45110723Sseanc u_int len; 46110723Sseanc struct rand_node *next; 47110723Sseanc}; 48110723Sseanc 49110723Sseancint randomize_fd(int fd, int type, int unique, double denom); 50110723Sseanc 51110723Sseanc#endif 52