我有一个随机密码生成器。它本身工作正常。当我将它放在 while 循环中时,即使种子看起来不同,我也会得到相同的密码。
declare @count int = 0
declare @end int = 500
while (@count < @end)
BEGIN
DECLARE @r varchar(6)
select @r = coalesce(@r, '') +char(
case when r between 0 and 9 then 48
when r between 10 and 35 then 55
else 61 end + r)
from master..spt_values
cross join
(SELECT CAST(RAND(ABS(CHECKSUM(NEWID()))) *61 as int) r) a
where type = 'P' and number < 6
print(newId())
print(@r)
set @count = @count + 1
END