2

I am quite new to KDB+ and have a question about generating random numbers.

Lets say I want to create num random unique numbers.

When i use this

q)10?10
q)-10?10

I get 10 random numbers in line 1 and 10 unique random numbers in line 2 (range from 0 to 9)

When I want to introduce a variable like this

q)num:10
q)num?10  / works
q)-num?10 / dont work

The generation of unique randoms does not work.

Whats the correct syntax for this?

Thanks in advance

Rahul
  • 3,914
  • 1
  • 14
  • 25
Martin Mlostek
  • 2,755
  • 1
  • 28
  • 57

1 Answers1

2

This will give you num unique numbers between 0 and 9.

q)(neg num)?10
coopejoh
  • 61
  • 1