Multiple distinct objects: Difference between revisions

Content added Content deleted
(Added Wren)
m (→‎{{header|REXX}}: added the computer programming language REXX.)
Line 1,184: Line 1,184:


produces <code>$n</code> distinct objects.
produces <code>$n</code> distinct objects.


=={{header|REXX}}==
This entry is modeled after the '''Erlang''' entry.
<lang rexx>/*REXX program does a list comprehension that will create N random integers, all unique.*/
parse arg n lim . /*obtain optional argument from the CL.*/
if n=='' | n=="," then n= 20 /*Not specified? Then use the default.*/
if lim=='' | lim=="," then lim= 100000 /* " " " " " " */
lim= min(lim, 1e5) /*limit the random range if necessary. */
randoms= /*will contain random list of integers.*/
#= 0 /*counter used to ensure uniqueness. */
do j=1 for n /*gen a unique random integer for list.*/
do until wordpos(?, @)==0 /*ensure " " " " " */
?= random(0, 100000) /*Not unique? Then obtain another int.*/
end /*until*/ /*100K is the maximum range for RANDOM.*/
@= @ ? /*add an unique random integer to list.*/
end /*j*/ /*stick a fork in it, we're all done. */</lang>
<br><br>


=={{header|Ruby}}==
=={{header|Ruby}}==