I am creating a class diagram where one of the attributes is initialized to a random value. What is the convention in a class diagram for showing that an attribute is initialized to a random value?
In UML, the default value of an attribute is a so-called ValueSpecification
, which includes among others literal values (String, Number, ...),
as well as Expressions
/OpaqueExpressions
where you can specify an expression in some language, include programming and natural ones.
For further reading see Chapter 8 - Values in UML Specs