I am attempting to insert a random number into a sort field in a temporary table.

I am using this in a stored procedure:

DECLARE @max int
select @max = count(ProfileId) from #tempresults

update #tempresults
set Sort = Rand(@Max)
where Sort = 0

I set the Sort field a default value of 0 and so if no sort value exists I wish to update the value with a random number. Does this make sense?

Anyone any ideas?
Cheers