Email or username:

Password:

Forgot your password?
Top-level
ruffni

@toby3d so, since there are only 21 distinct numbers from 1.0 to 3.0 i'm guessing you don't mean *set*, since in maths this implies distinct elements.

if you want a list of say x=3 elements to average 2.35. this means you want r[0]+r[1]+r[2]=2.35*3 ±(3*0.5). r[] being the elements of the resulting list.
i'd start with 2.35*3=7.05, choose one element at random (e.g. 1.4), subtract the number 7.05-1.4=5.65, memoize the result.
repeat until the result of the subtrction is between 1.0 and 3.0.

2 comments
Maxim Lebedev

@ruffni "memorize the result": you mean what I need add random numbers in array and substruct until I got result between 1.0 and 3.0?

ruffni

@toby3d not sure if i understand you correctly, but yes.
altough this might possibly not always render the requested number of elements, but it might work :)

Go Up