Try this:
UPDATE your_table s
JOIN
(SELECT (@r:=@r+1) rn, t.name FROM
(SELECT DISTINCT name FROM your_table) t
,(SELECT @r:=399) nums) tab
ON tab.name = s.name
SET s.ID = tab.rn;
Here is working code at SQL Fiddle: http://www.sqlfiddle.com/#!2/b831ed/1