You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Hans Zeller (JIRA)" <ji...@apache.org> on 2018/04/24 16:26:00 UTC

[jira] [Created] (TRAFODION-3042) RAND() function is not always random

Hans Zeller created TRAFODION-3042:
--------------------------------------

             Summary: RAND() function is not always random
                 Key: TRAFODION-3042
                 URL: https://issues.apache.org/jira/browse/TRAFODION-3042
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-exe
    Affects Versions: 2.2.0
            Reporter: Hans Zeller


When trying the RAND() function, I found that it does not always behave as I would expect. I tried this example:
{noformat}
>>select rand(), rand(), rand() from dual;

(EXPR)      (EXPR)      (EXPR)    
----------  ----------  ----------

  78242471    78511383    78612225

--- 1 row(s) selected.
>>select rand(), rand(), rand() from dual;

(EXPR)      (EXPR)      (EXPR)    
----------  ----------  ----------

1589208276  1589460381  1589561223

--- 1 row(s) selected.
>>select rand(), rand(), rand() from dual;

(EXPR)      (EXPR)      (EXPR)    
----------  ----------  ----------

134371215   134724162   134858618

--- 1 row(s) selected.
>>
{noformat}

So, it seems that if we call rand() within a very short time, the value will be non-random.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)