Anonymous user
Generate random numbers without repeating a value: Difference between revisions
Generate random numbers without repeating a value (view source)
Revision as of 19:34, 24 August 2021
, 2 years ago→{{header|REXX}}: elided the commatizing code.
m (→{{header|Wren}}: Added libheader.) |
m (→{{header|REXX}}: elided the commatizing code.) |
||
Line 73:
if datatype(seed, 'W') then call random ,,seed /*Specified? Then use the seed. */
w= 6
title= ' random integers (1 ──► '
say ' index │'center(title, 1 + cols*(w+1) ) /*display the output title. */
say '───────┼'center("" , 1 + cols*(w+1), '─') /* " " " separator*/
Line 86:
$=; idx= 1
do o=1 for n; x= @.o /*obtain a random integer from random @*/
$= $ right(
if o//cols\==0 then iterate /*have we populated a line of output? */
say center(idx, 7)'│' substr($, 2); $= /*display what we have so far (cols). */
Line 94:
if $\=='' then say center(idx, 7)"│" substr($, 2) /*possible show residual output.*/
say '───────┴'center("" , 1 + cols*(w+1), '─'); say
exit 0 /*stick a fork in it, we're all done. */</lang>
{{out|output|text= when using the default inputs:}}
<pre>
|