kdbq

adding random numbers to a list in kdb+ Q programming language


I am trying to create an empty list that takes integer values.

I have tried a:($['int])

I am trying to add 10 random numbers to the list but the only way i can do it is if i specify the number range(between 1-100) : a:(10?100)

thanks


Solution

  • This is what you could do:

    q)/Init empty list of ints
    q)a:`int$()
    q)/Check what the list looks like
    q)a
    `int$()
    q)/6h means that a is of type list of ints
    q)type a
    6h
    
    q)/Append 10 random numbers between 0-100 to list
    q)a,:10?100
    q)a
    12 10 1 90 73 90 43 90 84 63i