| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 416.1 | Image passing value via Symbol? | MONSTR::DUTKO | Nestor Dutko, VMS/VAXclusters CSSE | Mon Mar 02 1987 22:21 | 2 | 
|  |     How about an image which generates a random number and then assignes
    it to a DCL Symbol which is accessible?  Would that do?
 | 
| 416.2 |  | CHOVAX::YOUNG | Back from the Shadows Again, | Tue Mar 03 1987 00:34 | 6 | 
|  |     This is pretty easy to do, takes about 5-10 minutes to whip up a
    simple one.  If you would describe your requirements here, I am
    sure that someone will rise to the challenge and supply you with
    one in short order.
    
    --  Barry
 | 
| 416.3 | -< Tried! >- | 38007::GUNDAVARAM | From the lab of the Mad Scientist! | Tue Mar 03 1987 07:30 | 27 | 
|  | 	Hello:
	
	I tried doing that in BASIC, and it didn't work, Can
	somebody do this in any other language or can anybody 
	give me something written in DCL. This is how it should be:
	$ Randomize (1,100)	! Randomize(Min,Max)
	Should produce a random number from 1 to 100.
	Then you should be able to print it, offcourse.
	$ Write Sys$Output Randomize
						Thanks,
				
						-- Shishir --
	
 | 
| 416.4 | Next week, we'll do it in teco | MAY20::MINOW | I need a vacation | Tue Mar 03 1987 09:21 | 17 | 
|  | $	seed = 1234567			! Initial seed -- any value ok
$	i = 0
$ loop:	gosub rand			! Calculate a random number
$	result_mod_100 = result / 100
$	result_mod_100 = result - (result_mod_100 * 100)
$	write sys$output "''result', ''result_mod_100'"
$	i = 1 + 1
$	if (i .lt. 10) then goto loop
$	exit 1
$!
$! Based on VMS mth$random (circa 1980) and Decus C rand()
$! This algorithm is prone to non-random sequences when considering
$! the next pseudo-random number.
$!
$ rand:	seed = (seed * 69069) + 1
$	result = seed .and. %x7FFFFFFF	! Make it positive
$	return
 | 
| 416.5 | This should work in BASIC | FROST::HARRIMAN | bicker,bicker,bicker | Tue Mar 03 1987 10:48 | 19 | 
|  | 1	external integer function lib$set_symbol(string by desc,	&
    						 string by desc,	&
    						 long by ref)
    	map (dclsym) string symbol_value = 3%
    
    	declare string constant symbol_name = "THE_RANDOM_NUMBER"
    
    	randomize
    
        a_random_number = rnd		! between 0 and 1
    					! mult by 100 and truncate
    
    	lset symbol_value = PLACE$((a_random_number * 100%),10000%)
    
    	ret% = lib$set_symbol(symbol_name,symbol_value,2%)
    
    	end
    
    	
 | 
| 416.6 | Oops. | FROST::HARRIMAN | brouhaha..balderdash..ballyhoo | Tue Mar 03 1987 10:52 | 8 | 
|  |     Oops, the PLACE$ statement should read:
    
    LSET symbol_value = PLACE$(NUM1$(a_random_number * 100%),10000%)
    
    Teach me to type stuff in without trying it.
    
    /pjh
    
 | 
| 416.7 | F$CVT() | BIRMIC::BELL | Martin Bell | Tue Mar 03 1987 11:48 | 7 | 
|  |     A quick way for a "sort of" random number is get the hundreths of
    a second out of F$TIME(). Ok if you aren't wanting the numbers very
    frequently, and they don't have to be reproducable.
    
    hows about F$CVTIME("","","HUNDREDTH") ????
    
    mb
 | 
| 416.8 | Thanks | 37966::GUNDAVARAM | From the lab of the Mad Scientist! | Tue Mar 03 1987 16:26 | 15 | 
|  | 	Hello:
	MAY20::MINOW - Mr. Minow's DCL procedure is very good , except
	that it keeps generating the same numbers every time you run it.
	Is there a solution for that ??
	P.S	Thanks for all the replies
						Regards & Thanks,
		
						-=- Shishir -=-
 | 
| 416.9 | Randomize on run time | CADSYS::SLATER | Ken Slater | Tue Mar 03 1987 16:51 | 15 | 
|  | 
    The way to get different results each time you run the procedure is to
    randomize the seed
$	seed = 1234567			! Initial seed -- any value ok
    The typical way to do this is to pickup the low order part of the
    system time and use it set the value of the seed, on the assumption
    that in terms of milliseconds, the time you start the program
    running is random. You might try:
    
$	seed = f$integer( f$extract( 18, 5, F$time() ) - "." )
    which pulls out the seconds and hundreths of seconds of the current
    time and treats it as a 4 digit decimal integer...Ken
 |