# Generate data with negative skewness

Give an approach to generate 50 elements between 1 to 1000 with negative skewness.

• If you modify your question slightly so that it asks about approaches for generating data with negative skewness (rather than appearing to ask for R code) it is likely to be on topic. However, you'd have to explain more about what characteristics you need (you haven't even indicated whether you need continuous or discrete outcomes) – Glen_b Dec 24 '16 at 1:38
• Do you want continuous data, or discrete data? Do the bounds (1, & 1000) have to be absolute? How much skewness do you want? – gung - Reinstate Monica Dec 24 '16 at 13:36
• discrete data and skewness must be negative – Dumb Scientist Dec 24 '16 at 15:02
• Generate 50 values between $1$ and $1000$ using (literally) any technique you like. Compute their skewness. If it is positive, subtract all values from $1001.$ If it is exactly $0,$ start over. – whuber Aug 3 '18 at 14:52

One simple way:

Generate independent U1 and U2 being uniform over the required range. Take the larger of the two. This will give one draw from a left skew discrete distribution.

Just repeat as many times as you like.

Example in R:

x <- replicate(50,max(sample(1000,2,replace=TRUE)))
x
[1] 676 417 513 449 952 424 864 731 801 623 989 596 318 541 607 389 202 639 721
[20] 927 828 289  77 525 927 861 425 948 633 910 835 526 734 914 937 349 625 713
[39] 959 420 738 824 812 697 824 745  76 913 803 650


(Of course in R you could simply specify an increasing set of p's in a single call to sample but this approach is easy in a variety of languages)