Randomly generate ids

UDA
Enthusiast

Randomly generate ids

I have the following code.

What I want to do is, for each record not found in claim, i want to assign a distinct version_id to each version and a distinct ref_id to each reference.(all negative values)
Example:

version_id ref_id ref
-123 -154 123456-8
-124 -154 123456-8
-125 -154 123456-8

SELECT COALESCE((NULLIF(cmvr.version_id, '')) , -100 - ROW_NUMBER() OVER (ORDER BY cmvr.ref_desc)) version_id ,
COALESCE((NULLIF(cmvr.ref_id, '')) , -100 - ROW_NUMBER() OVER (ORDER BY cmvr.ref_desc)) ref_id ,
t.ref
FROM get_bcp_h_tasks t
LEFT JOIN claim cmvr on cmvr.ref_desc = t.ref
AND t.last_update_date >= cmvr.eff_date

QUALIFY RANK() OVER(PARTITION BY t.ref ORDER BY cmvr.eff_date desc) = 1

This code gives me the result
version_id ref_id ref
-123 -123 123456-8
-124 -124 123456-8
-125 -125 123456-8

Thanks in advance