How to make soft constraint for dynamic array type

In reply to chr_sue:

i have tried like that…means
rand bit [31:0] data_in[$:40];

but it is showing same error

thanks,