Skip to main content
16-Pearl
July 22, 2018
Solved

Random unique integers - problem

  • July 22, 2018
  • 1 reply
  • 2337 views

I grabbed this code from an old posting and converted it to 4.0.  It does what it is supposed to do - generate random unique integers.  But there is a problem - if I request a dataset longer than the max value it never finishes - just crunches for ever. (in Prime or 15) I can't figure out why it would do that.  Anyone see the fix? (or have another tool that generates unique integers?)

 

2018-07-21_20-44-24.jpg

Best answer by DJF

Nevermind.  I guess I am asking the impossible.  You can't have 11 unique integers between 1 and 10, can you?  (In my defense, it's late saturday.)

1 reply

DJF16-PearlAuthorAnswer
16-Pearl
July 22, 2018

Nevermind.  I guess I am asking the impossible.  You can't have 11 unique integers between 1 and 10, can you?  (In my defense, it's late saturday.)

23-Emerald IV
July 22, 2018

Add a first line:

if n>m  return error("Check your parameters.")

 

Luc

DJF16-PearlAuthor
16-Pearl
July 22, 2018

Good idea.  Slight twist, I just redefine the max number.  Here's my final version; added max/min range of values.

2018-07-22_10-29-01.jpg