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.