Skip to main content
24-Ruby IV
December 14, 2022
Solved

Lotto game

  • December 14, 2022
  • 1 reply
  • 3192 views

Friends, I need a function that returns a vector containing n natural random non-repeating numbers (Lotto game)

Best answer by LucMeekes

With all numbers from 0 to n-1:

LucMeekes_0-1671029454648.pngLucMeekes_1-1671029464121.png

 

or n out of N, where N is much larger:

LucMeekes_2-1671029623196.pngLucMeekes_3-1671029631537.png

 

Success! ( with the Christmas lottery?)

Luc

 

Mathcad and Prime express files attached.

1 reply

LucMeekes23-Emerald IVAnswer
23-Emerald IV
December 14, 2022

With all numbers from 0 to n-1:

LucMeekes_0-1671029454648.pngLucMeekes_1-1671029464121.png

 

or n out of N, where N is much larger:

LucMeekes_2-1671029623196.pngLucMeekes_3-1671029631537.png

 

Success! ( with the Christmas lottery?)

Luc

 

Mathcad and Prime express files attached.

24-Ruby IV
December 15, 2022

Thanks, but Mathcad 15

ValeryOchkov_0-1671087684060.png

 

25-Diamond I
December 15, 2022

You may use

Werner_E_1-1671089657435.png

or even better

Werner_E_2-1671089863548.png

because that way you chose numbers from 1 to n (and not from 0 to n-1) which may be more appropriate for a lottery.

A shorter variant without using "max" is

Werner_E_3-1671090208234.png