Thursday, May 11, 2017

Random-number wrapper

Usage:
  
my_random_number1=rnd(higher);        // between 0-higher
my_random_number2=rnd(higher,seed);   // seeded  between 0-higher
my_random_number3=rnd(lower,higher);  // between lower-higher
my_random_number4=rnd(higher,lower);  // between lower-higher

function rnd(a = 1, b = 0, s = []) = 
  s == [] ? 
   (rands(min(a, b), max(   a, b), 1)[0]) 
  : 
   (rands(min(a, b), max(a, b), 1, s)[0])
  ; 

No comments:

Post a Comment