#define ALL 43 //0~42の合計43個から
#define NEED 6 //6個選ぶとして

if ALL < NEED : dialog "ALL が NEED 未満\nALL="+ALL+" NEED="+NEED,1,"MyError!" : end

//初期化
dim a, ALL
repeat ALL : a(cnt) = cnt : loop

//シャッフル
randomize
repeat NEED
  idx = rnd(ALL-cnt)+cnt   //←*******ここ、これでもいけるんじゃね?*********
  //ここで2つをスワップ
  tmp = a(cnt) : a(cnt) = a(idx) : a(idx) = tmp
loop

//処理が終了した、結果を確認 ****
sdim result, 32*ALL : notesel result
repeat ALL
  noteadd "a[" + strf("%2d",cnt) + "] = " + a(cnt)
  if(cnt == NEED-1) : noteadd "↑ ここまで"
loop
mesbox result, ginfo_winx,ginfo_winy, 0