title: How do I make random not output duplicate string answers in batch?
body: <p>What can I do to make this code NOT output duplicates? Currently, it has a high chance of outputting a duplicate and I would like it to print randomly but not duplicate outputs.</p>
  
  <pre><code>@echo off
  SETLOCAL EnableDelayedExpansion
  for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# &amp; echo on &amp; for %%b in (1) do     rem"') do (
    set "DEL=%%a"
  )
  
  :fruits
  set i=0
  for %%a in (apple banana grape lime) do (
     set /A i+=1
     set fruit[!i!]=%%a
  )
  
  :food
  for /l %%x in (1, 1, 2) do (
  call :rand
  call :colorEcho 70 !fruit!
  echo/
  )
  pause
  
  exit
  
  :rand
  set /a rand=%random%%%4+1
  set fruit=!fruit[%rand%]!
  GOTO :EOF
  
  :colorEcho
  echo off
  &lt;nul set /p ".=%DEL%" &gt; "%~2"
  findstr /v /a:%1 /R "^$" "%~2" nul
  del "%~2" &gt; nul 2&gt;&amp;1
  GOTO :EOF
  </code></pre>