aboutsummaryrefslogtreecommitdiff
path: root/src/slalib/random.f_sun4_Solaris
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-03-04 21:21:30 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-03-04 21:21:30 -0500
commitd54fe7c1f704a63824c5bfa0ece65245572e9b27 (patch)
treeafc52015ffc2c74e0266653eecef1c8ef8ba5d91 /src/slalib/random.f_sun4_Solaris
downloadcalfuse-d54fe7c1f704a63824c5bfa0ece65245572e9b27.tar.gz
Initial commit
Diffstat (limited to 'src/slalib/random.f_sun4_Solaris')
-rw-r--r--src/slalib/random.f_sun4_Solaris56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/slalib/random.f_sun4_Solaris b/src/slalib/random.f_sun4_Solaris
new file mode 100644
index 0000000..9f49fb6
--- /dev/null
+++ b/src/slalib/random.f_sun4_Solaris
@@ -0,0 +1,56 @@
+ REAL FUNCTION sla_RANDOM (SEED)
+*+
+* - - - - - - -
+* R A N D O M
+* - - - - - - -
+*
+* Generate pseudo-random real number in the range 0 <= X < 1.
+* (single precision)
+*
+* !!! Sun 4 dependent !!!
+*
+* Given:
+* SEED real an arbitrary real number
+*
+* Notes:
+*
+* 1) The result is a pseudo-random REAL number in the range
+* 0 <= sla_RANDOM < 1.
+*
+* 2) SEED is used first time through only.
+*
+* Called: RAND (a REAL function from the Sun Fortran Library)
+*
+* P.T.Wallace Starlink 14 October 1991
+*
+* Copyright (C) 1995 Rutherford Appleton Laboratory
+*-
+
+ IMPLICIT NONE
+
+ REAL SEED
+
+ REAL RAND
+
+ REAL AS
+ INTEGER ISEED
+ LOGICAL FIRST
+ SAVE FIRST
+ DATA FIRST /.TRUE./
+
+
+
+* If first time, turn SEED into a large, odd integer, and start the
+* generator
+ IF (FIRST) THEN
+ AS=ABS(SEED)+1.0
+ ISEED=NINT(AS/10.0**(NINT(ALOG10(AS))-6))
+ IF (MOD(ISEED,2).EQ.0) ISEED=ISEED+1
+ FIRST=.FALSE.
+ AS=RAND(ISEED)
+ END IF
+
+* Next pseudo-random number
+ sla_RANDOM=RAND(0)
+
+ END