         MACRO                                                                  
&N       RANDOM  &R1,&R2                                                        
* ******************************************************************* *         
*                                                                     *         
*                         R A N D O M                                 *         
*                                                                     *         
*        Returns a random number between the 2 specified numbers      *         
*                                                                     *         
*        The generated random number is returned in R0 as a binary    *         
*        number.                                                      *         
*                                                                     *         
         LCLC  &LAB                                                             
         LCLA  &R3                                                              
         AIF   (K'&N EQ 0).LABEND                                               
&LAB     SETC  '&N'                                                             
&LAB     EQU   *                                                      *         
.LABEND  ANOP                                                                   
         AIF   (K'&R1 NE 0).NUM1OK                                              
         MNOTE 8,'***** No numbers specified ***********************'           
         AGO   .END                                                             
.NUM1OK  ANOP                                                                   
         AIF   (K'&R2 NE 0).NUM2OK                                              
         MNOTE 8,'***** No second number specified *****************'           
         AGO   .END                                                             
.NUM2OK  ANOP                                                                   
         AIF   ('&R1' NE '&R2').NUM2OK2                                         
         MNOTE 8,'***** Same number specified for both *************'           
         AGO   .END                                                             
.NUM2OK2 ANOP                                                                   
         AIF   ('&R1' LT '&R2').NUM2OK3                                         
         MNOTE 8,'***** First number is the greated of the 2 *******'           
         AGO   .END                                                             
.NUM2OK3 ANOP                                                                   
&R3      SETA  &R2-&R1                                                          
         TIME  BIN                                                              
         LR    1,0                                          e                   
         SLL   1,20                                                             
         SRL   1,20                                                             
         SLL   0,24                                                             
         SRL   0,24                                                             
         AR    0,1                                                              
         SRL   1,8                                                              
         AR    0,1                                                              
         BCT   1,*-2                                                            
         LA    1,&R2                                                            
         CR    0,1                                                              
         BNH   *+10                                                             
         SR    0,1                                                              
         B     *-8                                                              
         LA    1,&R1                                                            
         CR    0,1                                                              
         BNL   *+14                                                             
         LA    1,&R3                                                            
         AR    0,1                                                              
         B     *-16                                                             
*                                                                     *         
*  Copyright - Abbydale Systems LLC.                                  *         
* ******************************************************************* *         
.END     ANOP                                                                   
         MEXIT                                                                  
         MEND