Trigger is the only way to do it.
Virtual column is different from what you want, and that will not accept
DBMS_RANDOM.RANDOM, because that is not deterministic:
...it can contain only the following forms of expression:
- Columns of the subject table — the table being created, altered, or indexed
- Constants (strings or numbers)
- Deterministic functions — either SQL built-in functions or user-defined functions
The syntax of default values for columns is similar to your original statement, but that does not accept
DBMS_RANDOM.RANDOM because PL/SQL is not allowed there:
Restrictions on Default Column Values
Default column values are subject to the following restrictions:
- A DEFAULT expression cannot contain references to PL/SQL functions or to other columns, the pseudocolumns LEVEL, PRIOR, and ROWNUM, or
date constants that are not fully specified.
- The expression can be of any form except a scalar subquery expression.