GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
genunf.f
Go to the documentation of this file.
1  REAL FUNCTION genunf(low,high)
2 C**********************************************************************
3 C
4 C REAL FUNCTION GENUNF( LOW, HIGH )
5 C
6 C GeNerate Uniform Real between LOW and HIGH
7 C
8 C
9 C Function
10 C
11 C
12 C Generates a real uniformly distributed between LOW and HIGH.
13 C
14 C
15 C Arguments
16 C
17 C
18 C LOW --> Low bound (exclusive) on real value to be generated
19 C REAL LOW
20 C
21 C HIGH --> High bound (exclusive) on real value to be generated
22 C REAL HIGH
23 C
24 C**********************************************************************
25 C .. Scalar Arguments ..
26  REAL high,low
27 C ..
28 C .. External Functions ..
29  REAL ranf
30  EXTERNAL ranf
31 C ..
32 C .. Executable Statements ..
33  IF (.NOT. (low.GT.high)) go to 10
34  WRITE (*,*) 'LOW > HIGH in GENUNF: LOW ',low,' HIGH: ',high
35  WRITE (*,*) 'Abort'
36  CALL xstopx('LOW > High in GENUNF - Abort')
37 
38  10 genunf = low + (high-low)*ranf()
39 
40  RETURN
41 
42  END