• There is, of course, a way around this problem. Simply build a view that returns the value of the function RAND() and use the view in your UDF.

    You can find an example using NEWID() in my blog A Variable Length Random String.