This would do it, I think, if all you're after is a random seed. You can
extract some of the middle digits of this with integer division.
$ cat time.ox
#include <oxstd.h>
main()
{
decl m1;
m1=int(today());
println(m1);
}
$ ox time.ox
Ox version 2.10 (AIX) (C) J.A. Doornik, 1994-99
944228032
Kit Baum
Boston College Economics
--On Fri, Dec 3, 1999 8:07 -0800 Mark Leeds <[log in to unmask]> wrote:
>
> this is a "converting strings to doubles or integers" question. I set a
> variable tmp equal to time() so that tmp is a string. I then get the
> substring by doing tmp = tmp[6:7]. Now tmp is say "50" but it's a string
> not a number. I want to convert it to a number ( integer or double is
> fine ) and I tried double(tmp) and int(tmp) but these gave me back very
> strange numbers ( not 50 ). I am doing this because I want to use the
> clock to set a random seed. thanks a lot.
>
> Mark
-----------------------------------------------------------------
Kit Baum [log in to unmask] http://fmwww.bc.edu/ec-v/baum.fac.html
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|