Generates a real random number between two boundaries. Syntax : HB_Random( [<nMaxLimit>] ) --> nRandomNumber or HB_Random( <nMinLimit>, <nMaxLimit> ) --> nRandomNumber Arguments : <nMaxLimit> : Upper boundary of the random number; default is 1. <nMinLimit> : Lower boundary of the random number; default is 0. Note that the first parameter is only interpreted as lower boundary when two parameters are passed. Return : A random real numeric value with two decimal digits, limited by the two boundaries. Description : This function generates a real random number between two boundaries. The boundary values are excluded from the range. When only one boundary is passed to the function, it is considered the maximum boundary. The minimum boundary, in that case, is zero. When no boundaries are passed, the function returns a number between 0.00 and 1.00. Note : Use function HB_RandomInt() to generate random integer values. See also: HB_RandomInt(), HB_RandomSeed() Example : PROCEDURE Main // Random number between 0.01 and 0.99 ? HB_Random() // Random number between 0.01 and 9.99 ? HB_Random(10) // Random number between 8.01 and 9.99 ? HB_Random(8,10) RETURN
Harbour is 100% Clipper-compatible and supports many language syntax extensions
including greatly extended run-time libraries such as OLE, Blat, OpenSSL, FreeImage,
GD, TIP, Tpathy, PCRE, HbZip (zlib and bzip2), cURL, Cairo, its own implementation of
CTools and NanFor libraries and many others. Harbour has an active development
community and extensive third party support.
Harbour includes various extensions of Clipper language; such as class creation,
support for date constants, FOR EACH and SWITCH structures, many extensions to
RDD and language features and much more.
Introduction Clipper enables you to program nested GET/READ masks. The functions in this chapter are retained in Clipper Tools for compatibility reasons and to make them easy to use. The active GET is saved with the help of a character string and restored through this string later. This allows you to newly query inputs without losing your main input mask. You can save KEYTRAP() definitions the same way and redefine them as you wish. Important! It is impossible to use the saved information any longer that the runtime of an application. The character string that results cannot be saved to a file and reloaded later. Other functions in this chapter return information about GET fields, such as screen position, the names of the accompanying variables, or information about whether a field is currently active.
Introduction Despite the many capabilities of Clipper Tools, there are times when direct port or memory access is needed. The functions in this chapter serve this purpose. For example, you can read memory regions by byte, word, or as a string through the PEEK function. POKE functions enable you to write a byte or word to working memory, but not a string. Warning! POKE functions can be very dangerous. If you write to the wrong area in memory it can cause a lot of problems you may not foresee. Use POKE functions ONLY if you have extensive system knowledge. This also applies to all the IN/OUT functions in this chapter, which allow you to directly manipulate a port. For example, if you address a disk controller improperly, the result may lead to data loss.
Introduction This chapter offers an array of interesting mathematical functions to implement in Clipper. It includes trigonometric functions, finance- oriented math computations, and functions to determine the factorial, sign, or the next-largest integer of a value. SETPREC() is important for trigonometric functions. With this function you can specify the precision as a number of places to the right of the decimal. However, if it is less accurate, the speed is greater.
Introduction Functions that do not belong in any other module are assembled in this group under the Miscellaneous heading. However, this does not imply they are less useful. For example, use KEYTIME() or KEYSEC() to activate a Clipper procedure at a specific time, after a delay of seconds, implement file saves, or control demo programs. This module enables you to determine complements, determine data types, and query keyboard scan codes. Passing Parameters by Reference Finally, this chapter discusses functions that permit you to pass parameters by reference. To find more information on this subject, see Chapter 4, String Manipulations.
Introduction The functions in this chapter provide system information about the operating system (MS-DOS), the BIOS, and hardware. It determines a large number of system facts and settings -- from the DOS-COUNTRY setting to the mathematical coprocessor. It is even possible to warm or cold boot a computer from within a program. In addition, you can query and set DOS VERIFY and BREAK.
In this chapter, the group of functions determine the switch status and were implemented in the Clipper Tools. Clipper implemented the SET() function, so that these settings can be determined, set, and saved with this version. Therefore, some functions in this chapter only exist to enable compatibility with existing programs. All the affected functions are flagged with an "*". If the functions relate to the Clipper switches (SET's), the function name is represented as follows: CSET + the first four characters of the switch name. For example, if the switch is named CONFIRM, then the function that corresponds is CSETCONF(). If the parameter is optional and unspecified, the function returns the current setting for its switch, without a status change. When called with parameters, the function sets the switch to the passed value and returns the prior status as a value. In this way, a function call can both change a switch and save the old status. The logical value .T. corresponds to the ON setting of a switch; .F. corresponds to OFF. Example In the following example, the CONFIRM switch was set to .F.: lOldValue:= CSETCONF(.T.) After execution, the old variable lOldValue has a value of .F.; while the CONFIRM switch is ON (.T.). In addition to their usefulness with Clipper switches, these functions determine an assortment of other status information. For example, you can determine the current status of the debugger, set LASTKEY, and differentiate key traps. You can also determine the status of CAPS-LOCK, NUM-LOCK, INSERT, and SCROLL-LOCK.
Note: Since this section is about DOS-TEXT mode programming, considered as obsolete and details skipped.
Introduction The functions presented in this chapter are a useful extension of database handling. For example, you can determine if there is a memo file (.dbt) associated with a database, the number of decimal places, or the data type of a particular field.