Deutsch English
Alphabetical index
Array functions
CGI functions
Data types
Date functions
Debugging
Fulltext functions
Language elements
Numerical functions
  • abs()
  • arccos()
  • cos()
  • exp()
  • frac()
  • int()
  • log()
  • random()
  • round()
  • sin()
  • sqrt()
  • str()
  • testbit()
  • val()
    Operators
    Other functions
    Ramtext functions
    Selecting
    Socket functions
    Statistical functions
    Stream functions
    String functions
    System functions
    Table functions
    Text functions
    Home    Overview    Search    Impressum    Contact    Members
    Topic complex Numerical functions
    Function random()
    Short Random number
    Syntax RANDOM(n : INTEGER) : INTEGER
    Parameter n : positive whole number
    Return Random number of the area 0 to n-1
    See also:
    Description The random generator of the tdbengine returns statistically quite good distributed whole numbers.
    The initialisation depends on system values like the time (system time).
    Thus the sequence of the random numbers is normally not reproducible.

    Example 1: Random

    FROM a table DB a Random test with 10% of the records is made.

    VAR test : TBITS[]
      InitArray(test[FileSize(DB)])
      WHILE NBits(test)<0.10*FileSize(DB) DO
        test[1+RANDOM(FileSize(DB))]:=1
      END
      PutMarks(DB,test)
      // now 10% of table are marked


    User comments:
    Reproduzierbare Zufallsfolgen
    User: Thomas SeehausDate: 30.10.2004 22:34#3
    Für manche Dinge ist es sinnvoll reproduzierbare Folgen zu erzeugen, indem der Generator z. B. über eine Prozedur "randomize" mit einem bestimmten Wert initialisiert.
    Eine entsprechende Funktion würde ich mir für eine kommende tdbengine-Version wünschen.

    MfG
    Thomas Seehaus
    Write a comment:
    Name
    EMail
    Subject
    Text (Switch mode)

    Choose between
    the normal and the
    advanced editor.
    The advanced editor
    runs in IE 5+ and
    Mozilla 1.4+ only
    SPAM-Protection Please enter tdbengine in this field.

    tdbengine chat
    irc.tdbengine.org
    #tdbengine

       Copyright © 2003-2004 tdb Software Service GmbH
       Alle rechte vorbehalten. / All rights reserved
       Last changed: 21.10.2004
    {Fehler für :execmacro{execmacro="sessionspy"}