head	1.6;
access
	monica
	thoth
	fjsoria
	ljr;
symbols
	Eglin_alpha_1:1.1;
locks
	monica:1.6; strict;
comment	@// @;


1.6
date	94.12.23.00.06.12;	author ljr;	state Exp;
branches;
next	1.5;

1.5
date	94.12.20.05.22.29;	author monica;	state Exp;
branches;
next	1.4;

1.4
date	94.10.06.02.02.25;	author monica;	state Exp;
branches;
next	1.3;

1.3
date	94.08.21.15.21.14;	author monica;	state Exp;
branches;
next	1.2;

1.2
date	93.07.15.11.50.04;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	92.09.07.13.26.46;	author thoth;	state Exp;
branches;
next	;


desc
@utilities for IntPoint testing
@


1.6
log
@Changed rand48.h include guard to IA_NEED_CUSTOM_RAND48_H.
@
text
@// Emacs: -*- C++ -*-

static char rcsid[] = "$Id: pt-util.c,v 1.5 1994/12/20 05:22:29 monica Exp ljr $";

//
// $Log: pt-util.c,v $
// Revision 1.5  1994/12/20  05:22:29  monica
// added ifdef bplusplus block for rand48.h
//
// Revision 1.4  1994/10/06  02:02:25  monica
// updated for DOS filename convention
//
// Revision 1.3  1994/08/21  15:21:14  monica
// updated for file name shortening (DblPoint, etc)
//
// Revision 1.2  1993/07/15  11:50:04  thoth
// IA_ prefix for most classes now necessary.
// FloatPoint utils available now.
//
// Revision 1.1  92/09/07  13:26:46  thoth
// Initial revision
// 
//

#include <stdlib.h>

#include "IntPoint.h"
#include "pt-util.h"

#ifdef IA_NEED_CUSTOM_RAND48_H
#include "rand48.h"
#endif

IA_Point<int>
make_random_point(int dim, int bottom, int top )
{
    int   range;

    if (top < bottom) {
	int temp = top;
	top = bottom;
	bottom = temp;
    }
    range = top - bottom + 1;    

#define randlong()	lrand48()

    int	*ip = new int [dim];

    for (int idx=0; idx<dim; idx++)
	ip[idx] = (int) (bottom +  randlong() % range);
    return IA_Point<int>(ip, dim, 1);
}

IA_Point<double>
make_random_Fpoint(int dim, double bottom, double top )
{
    double   range;

    if (top < bottom) {
	double temp = top;
	top = bottom;
	bottom = temp;
    }
    range = top - bottom + 1;    

#define randdbl()	drand48()

    double	*ip = new double [dim];

    for (int idx=0; idx<dim; idx++)
	ip[idx] = (int) (bottom +  randdbl() * range);
    return IA_Point<double>(ip, dim, 1);
}
@


1.5
log
@added ifdef bplusplus block for rand48.h
@
text
@d3 1
a3 1
static char rcsid[] = "$Id: pt-util.c,v 1.4 1994/10/06 02:02:25 monica Exp monica $";
d7 3
d30 1
a30 1
#ifdef __BCPLUSPLUS__
@


1.4
log
@updated for DOS filename convention
@
text
@d3 1
a3 1
static char rcsid[] = "$Id: pt-util.c,v 1.3 1994/08/21 15:21:14 monica Exp monica $";
d7 3
d27 3
@


1.3
log
@updated for file name shortening (DblPoint, etc)
@
text
@d3 1
a3 1
static char rcsid[] = "$Id: point-utils.c,v 1.2 1993/07/15 11:50:04 thoth Exp monica $";
d6 4
a9 1
// $Log: point-utils.c,v $
d22 1
a22 1
#include "point-utils.h"
@


1.2
log
@IA_ prefix for most classes now necessary.
FloatPoint utils available now.
@
text
@d3 1
a3 1
static char rcsid[] = "$Id: point-utils.c,v 1.1 92/09/07 13:26:46 thoth Exp Locker: thoth $";
d6 5
a10 1
// $Log:	point-utils.c,v $
d22 2
a23 2
IA_IntPoint
make_random_point(unsigned dim, int bottom, int top )
d38 1
a38 1
    for (unsigned idx=0; idx<dim; idx++)
d40 1
a40 1
    return IA_IntPoint(ip, dim, 1);
d43 2
a44 2
IA_FloatPoint
make_random_Fpoint(unsigned dim, double bottom, double top )
d59 1
a59 1
    for (unsigned idx=0; idx<dim; idx++)
d61 1
a61 1
    return IA_FloatPoint(ip, dim, 1);
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
static char rcsid[] = "$Id$";
d6 4
a9 1
// $Log$
d18 1
a18 1
IntPoint
d36 22
a57 1
    return IntPoint(ip, dim, 1);
@
