Random number Generator (Variable Limit Version)

Generates a random number in the specified range and stores it in a data item. It can be used for determining the person in charge of processing by the generated numerical value for the sake of "preventing fixation of reviewers", or "determining strict winner numbers" in lottery, and so on.
Random Number Generator (dynamic)
random-number-dynamic-20171020-addonxml.txt
(md5:6e1b623334c01baa3689c63f4d526018)

    • A’: The numerical value stored in the selected Data Item A (e.g.: “100”)
    • A random number that does not exceed the config A'(e.g.: 0 to 99) will be stored in the Data Item selected in config B
    • A’ is supposed to be an integer. (If it were a fraction, A’ becomes a truncated value)

    A. Select NUMERIC DATA for Max Number (100 returns 0 - 99)Data selectNumericRequired
    B. Select NUMERIC DATA for Random Number (update)Data selectNumericRequired
    -variable namevariable label
    Aconf_DataIdASelect NUMERIC DATA for Max Number (100 returns 0 - 99)
    Bconf_DataIdBSelect NUMERIC DATA for Random Number (update)
    // Random Number Generator - Dynamic (ver. 20181020)
    // (c) 2017, Questetra, Inc. (the MIT License)
    
    //// == Config Retrieving / 工程コンフィグの参照 ==
    var dataIdA = configs.get( "conf_DataIdA" ) + "";
    var dataIdB = configs.get( "conf_DataIdB" ) + "";
    // convet 'java.lang.String' to 'javascript string'
    
    //// == Data Retrieving / ワークフローデータの参照 ==
    var maxNum = engine.findDataByNumber( dataIdA ) - 0;
    // convet 'java.math.BigDecimal' to 'javascript number'
    
    //// == Calculating / 演算 ==
    var randNum = Math.floor( Math.random() * maxNum );
    // Math.random(): 0.00 to 0.99
    
    //// == Data Updating / ワークフローデータへの代入 ==
    engine.setDataByNumber( dataIdB, java.math.BigDecimal( randNum ) );