Skip to content

Instantly share code, notes, and snippets.

@andrewcharlesmoss
Last active March 28, 2024 06:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewcharlesmoss/092819ed423d5dbed7ff663f9a6ac4c1 to your computer and use it in GitHub Desktop.
Save andrewcharlesmoss/092819ed423d5dbed7ff663f9a6ac4c1 to your computer and use it in GitHub Desktop.
RANDUNIQUE
// v2
/* UPDATE 13/02/2022
Added columns argument and made each optional
*/
// Returns an array of unique random numbers
RANDUNIQUE =
LAMBDA([rows],[columns],[min],[max],
INDEX(
SORTBY(
SEQUENCE(max+1-min,,min),
RANDARRAY(max+1-min)
),
SEQUENCE(rows,columns)
)
)
// v1
// Returns an array of unique random numbers
RANDUNIQUE =
LAMBDA(rows,min,max,
INDEX(
SORTBY(
SEQUENCE(max+1-min,,min),
RANDARRAY(max+1-min)
),
SEQUENCE(rows)
)
)
@Omid-M22
Copy link

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment