Здравствуйте!
Вопрос к математикам:
Как сделать компактный генератор случайных неповторяющихся чисел? Эта порнуха, что изображена ниже - работает, но занимает много пространства + для каждого доп. числа нужно добавлять 5 строчек кода. Как можно преобразовать это в один цикл "for"?
$C1 = 1
$Work[$C1] = RND(1,5)
INC($C1)
$Work[$C1] = RND(1,5)
WHILE($Work[$C1] = $Work[$C1-1])
$Work[$C1] = RND(1,5)
END_CYC
INC($C1)
$Work[$C1] = RND(1,5)
WHILE($Work[$C1] = $Work[$C1-1] | $Work[$C1] = $Work[$C1-2])
$Work[$C1] = RND(1,5)
END_CYC
INC($C1)
$Work[$C1] = RND(1,5)
WHILE($Work[$C1] = $Work[$C1-1] | $Work[$C1] = $Work[$C1-2] | $Work[$C1] = $Work[$C1-3])
$Work[$C1] = RND(1,5)
END_CYC
INC($C1)
$Work[$C1] = RND(1,5)
WHILE($Work[$C1] = $Work[$C1-1] | $Work[$C1] = $Work[$C1-2] | $Work[$C1] = $Work[$C1-3] | $Work[$C1] = $Work[$C1-4])
$Work[$C1] = RND(1,5)
END_CYC
PRINT($Work[1])
PRINT($Work[2])
PRINT($Work[3])
PRINT($Work[4])
PRINT($Work[5])
PRINT(______)