home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xactus.zip / macros / rand.xc$ / xsmp32 / os2 / uk / rand.xcd
Text File  |  1994-09-29  |  1KB  |  26 lines

  1. /*************************************************************************
  2.  * Xact macro
  3.  *
  4.  *************************************************************************/
  5.  
  6. Parse Arg handle
  7.  
  8.     Say "This simple macro opens a new table window " ||,
  9.         "and creates 100 random numbers in the range of 0 to 100."
  10.  
  11.     tHandle =  XR_OpenTab()                    /* Create a new table */
  12.  
  13.     Call XR_WriteCell tHandle, i, 1, "Number"  /* set the title of column 1 */
  14.     Call XR_WriteCell tHandle, i, 2, "Random"  /* set the title of column 2 */
  15.  
  16.     rand = Random(0, 100, Time('S'))           /* create a random number */
  17.                                                /* 'seed' is no. of seconds since midnight */
  18.     Do i = 1 To 100
  19.         rand = Random(0, 100)                  /* create a random number */
  20.         Call XR_WriteCell tHandle, i, 1, i     /* write line number into column 1 */
  21.         Call XR_WriteCell tHandle, i, 2, rand  /* write random number into column 2 */
  22.     End
  23.  
  24. Return
  25.  
  26.