S2 = K: S1 = V ' the largest number, V, and numbers per combination, K.
FOR j = 1 TO S1
IF RND < S2 / S1 THEN
PRINT j;
S2 = S2 — 1
END IF
S1 = S1 — 1
NEXT j: PRINT
NEXT ION
DIM N AS LONG ‹total elements in the set to be shuffled
› e.g. N = 52 cards or N = 49 lotto balls
DIM X() AS LONG 'create an array with all the elements from 1 to N
REDIM X(N)
FOR I = 1 TO N
X(I) = I
NEXT I
FOR I = 1 TO N — 1
SWAP X(I), X(INT(RND * (N — I + 1) + I))
NEXT I
FOR ION = 1 TO GU
FOR I = 1 TO V — 1
SWAP X(I), X(INT(RND * (V — I + 1) + I))
NEXT I
FOR J = 1 TO K
PRINT X(J);
NEXT J
PRINT
NEXT ION
I am the Great Mighty Poo,
and I'm going to throw my shit at you.
A huge supply of tish comes from my chocolate starfish.
How about some scat, you little twat?
>>1122591
Блять, надо переиграть.
>>1122590
Это QBasic, да? Я уж и забыл его. Что за операторы REDIM и SWAP?
(← + Сtrl) вернуться назадк новым сообщениям (Сtrl + →)