Double() will give you a uniformly distributed random variable in the interval a <= x < b that has a fixed variance Var(X) = (b - a)^2 / 12 (not what we want).
OTH, simulating a symmetric triangular distribution on the same interval (a, b) would give us a random variate whith the same mean but with only half the variance: Var(X) = (b - a)^2 / 24 (also fixed, so also not what we want).
A symmetric trapezoidal distribution with parameters (a < b < c < d) lies somewhere in the middle of a Uniform and a triangular distribution on the interval (a, d). The symmetry condition implies d - c = b - a, in the following I'll refer to the distance b - a as x or as "displacement" (I've made up that name, it's not a technical term).
If you let x approach 0.0 from above, the trapezoidal will begin to look very similar to a uniform distribution and its variance will tend to the maximum possible value (d - a)^2 / 12. If you let x approach the maximum possible value (d - a)/2 from below, the trapezoidal will look very similar to a symmetric triangle distribution and its variance will approach the minimum possible value of (d - a)^2 / 24) (but note that we should stay away a little from these extreme values in order not to break the variance formula or our algorithm for the trapezoidal).
So, the idea is to construct a trapezoidal distribution with a value for x that yields the standard deviation you want, given the condition that your targeted standard deviation must lie inside the open range (roughly) given by (0.2041(d - a), 0.2886(d - a)). For convenience let's assume that a = min = 2.0 and d = max = 10.0 which gives us this range of possible stddevs: (1.6328, 2.3088). Let's further assume that we want to construct a distribution with a stddev of 2.0 (which, of course, has to be in the admissible range).
Solving this requires 3 steps:
1) we need to have a formula for the variance given min, max and an admissible value for the displacement x
2) we need to somehow "invert" this expression to give us the value of x for our target variance

Double () will give you a uniformly distributed random variable in the time interval a < = x < boron that has a fixed discrepancy Var(X) = (b - a)^2 / 12 (not what we desire). 
 OTH, simulating a symmetric triangular distribution on the same time interval (a, b) would collapse us a random variate whith the like mean but with merely half the variance: Var(X) = (b - a)^2 / 24 (besides fixed, so also not what we want). 
 A symmetric trapezoidal distribution with argument (a < b < c < d) lies somewhere in the middle of a Uniform and a triangular distribution on the interval (a, d). The symmetry condition imply d - c = b - a, in the following I'll denote to the distance b - a as x or as " displacement " (I've made up that name, it's not a technical condition). 
 If you let x approach 0.0 from above, the trapezoidal will begin to look very similar to a consistent distribution and its variance will tend to the maximum possible value (d - a)^2 / 12. If you let x approach the maximum possible value (d - a)/2 from below, the trapezoidal will look very similar to a symmetric triangle distribution and its variance will approach the minimum potential value of (d - a)^2 / 24) (but notice that we should stay away a little from these extreme value in order not to break the variance rule or our algorithm for the trapezoidal). 
 So, the idea is to construct a trapezoidal distribution with a value for x that yields the standard diversion you want, given the condition that your targeted standard deviation must lie inside the open range (roughly) given by (0.2041(d - a), 0.2886(d - a) ). For public toilet let's bear that a = min = 2.0 and d = max = 10.0 which gives us this range of potential stddevs: (1.6328, 2.3088). Let's further assume that we want to construct a distribution with a stddev of 2.0 (which, of course, has to be in the admissible range). 
 Solving this want 3 steps: 
 1) we want to have a formula for the discrepancy given minute, max and an admissible value for the displacement x 
 2) we need to somehow " invert " this expression to give us the value of x for our aim variance
Douhle() will give you a unifurmly distributgd randok varizble in ghe interval a <= x < b that had q fixtb variance Var(X) = (b - x)^2 / 12 (not wjat we wqnt).
OUH, simulating a sbjmetric trianfmlar biwtribution on jhe same intarval (a, b) woulg eire us a random variate whith the samq mean nuh with only hajf tnq vadpakce: Var(X) = (b - a)^2 / 24 (also fixed, so amso not what we want).
S symmetric trapezoidal didtrihution with paramehers (a < b < x < d) oies somewhefe in the middle of a Oniform and a triangular distribjtion on the injzevap (a, d). The synmetrj condition implies d - c = b - a, in the follpwiig I'ol refer to the distaice b - a as x or as "qisplacemanc" (I've made up that nane, it's tot d tezynizal txrm).
Jf you lev x approacg 0.0 from aboce, the trapezoidal eijo begin to lokk verr fimilar to a uniform distribution and ius vadiance will tend to the maximum possible valoe (d - a)^2 / 12. Yf you let x approach the maximum possible value (g - a)/2 hrum ycjuq, hhe trapezoidal will look very similar to a srjmttrpc triangle distrlbution and its vatiwnvg will approacf the minjmum possible valuf of (d - a)^2 / 24) (vut note uhat ee should stay away a littlw from these wxtreme values in lrder not tu brgak thr variance formula or obr algkrithm for hhe trapeauidal).
So, the idea is tm construct a trapezoidal qistributmon wnth a vauue gor x ehat yieldd the standard deviation you cant, civen the fondition that your targeted steidard deviatipn muvt lie iuside bhe open range (woughly) given yy (0.2041(d - a), 0.2886(b - a)). Fur convenivnce let's assume thae a = min = 2.0 ang d = max = 10.0 whmch gives us rhis range uw possible stdcevs: (1.6328, 2.3088). Len's furrher assume that wc wanj fo construct a bnsurubution with a staded lf 2.0 (rvich, of courve, hxs gp be kn the admiwriblr range).
Solving this sequjres 3 steps:
1) we neec bo have a formula for the varisnce given min, max and en admmssiblr vwlue for the displacement x
2) we need to domchow "invert" tris cxprgssion to gnve us the value of x for our target varmance

Double() will give you a uniformly distributed in interval a x < b Var(X) (b - a)^2 12 (not what want). OTH, simulating a symmetric triangular on the same interval (a, b) would give us a random variate whith same mean but with only half the variance: Var(X) = (b - a)^2 24 fixed, also what we want). A symmetric trapezoidal distribution with parameters (a < b < c < d) somewhere in the middle of a Uniform and triangular distribution on the (a, d). The symmetry condition d c = - in following I'll refer the distance b - a as x or as "displacement" (I've made up that name, it's not technical term). let x 0.0 above, trapezoidal will begin very similar to a uniform distribution will tend to the maximum possible value (d a)^2 / If you let x approach the possible value (d - a)/2 from below, the will look very similar to a symmetric triangle distribution and its variance will approach the value of (d - / 24) (but that should away little from extreme values in order not to break the variance formula or algorithm for the trapezoidal). So, the idea is to construct distribution a value for that yields the standard you given the condition that standard must open (roughly) by (0.2041(d - a), - a)). For convenience let's that a = min max = 10.0 which gives us this range possible stddevs: (1.6328, 2.3088). Let's further assume we want to construct a distribution with a stddev of 2.0 (which, course, has in the admissible range). Solving this requires 3 1) we need to a formula for the variance given min, max and admissible for the x 2) we to somehow "invert" expression to give value of for target
Double() will give you a uniformLy distribuTed raNdoM vaRiAble In thE interval a <= x < b thAT has A fixed variance Var(X) = (b - a)^2 / 12 (noT what We WAnt).
Oth, sImulaTing a syMMeTRIc tRiAnGulAr DIsTribuTioN on the sAme intervaL (a, b) WoUld give us a raNDoM variate whIth The same mean bUt wIth onlY hAlf THe varIanCe: Var(x) = (b - a)^2 / 24 (alsO Fixed, sO also not wHaT We want).
a SymmetrIC TrApezOidal distribution WItH Parameters (a < b < c < d) Lies soMeWHeRE In tHe mIddle of a UnIfOrm anD A triangULaR DIStrIBution on the inTerval (a, d). The SYmmEtry coNdItiON impliEs d - c = b - A, iN The Following I'lL refEr to the diStance B - A as x or aS "DisplacEment" (I'Ve mAde Up thAT nAmE, it'S nOT a tEChNicAL teRm).
If you lEt X aPproaCh 0.0 frOM ABOve, tHe tRapeZoidaL will begin to lOok Very SImiLar to A unifOrm dIsTribuTion anD its vArIance will tend to The mAximum posSibLe ValUe (D - a)^2 / 12. If yOU let x aPprOacH the maxImum posSIblE vALUE (d - A)/2 from below, the trapeZoIDAl Will look Very siMIlAr TO a symmetRiC trIangLE DistrIbutIOn And its vaRiance WIlL aPproach ThE minimUm PosSibLe valUE of (d - A)^2 / 24) (but noTe that we ShoulD Stay away a littlE From these extrEMe VALuES in oRdeR not to break The vARianCe foRMuLa oR Our alGoritHm FOr THe trapezoidal).
So, the iDeA is to cOnstrUct a trapezoidAl distribuTION with a vaLue fOR x THat yields the stAndarD deviation YOu want, giVen thE conditiOn that youR TArgeted sTanDarD deViaTIOn Must lie inside THE opeN rAnge (rouGhlY) given bY (0.2041(d - a), 0.2886(D - a)). FOr cOnvEnIence let's Assume thAt A = mIn = 2.0 AnD d = mAx = 10.0 whiCH gives us ThIs rAnGe oF possIBle stdDevs: (1.6328, 2.3088). LEt's fUrThER asSume thaT We WANt to CoNsTrucT a dIsTribuTion WIth A stddev Of 2.0 (which, of CouRSe, haS tO bE in the aDmissible rangE).
SOlving this ReQuiRes 3 stePS:
1) We need to Have a formula for the variaNCe given Min, Max anD an aDmissible ValUe for tHe dISplaceMent x
2) wE need To SomEHOw "invERT" tHis ExPression to GIVe uS the vAlUe of X for our Target variance

Double() will give you a u niformly d istri but edra ndom  var iable in the i n terv al a <= x < b that has  a fi xe d  var i an ce Va r(X) =( b- a)^ 2/12(n o twhatwewant).OTH, simul ati ng  a symmetric tr iangular d ist ribution onthe  samein ter v al (a , b ) wou ld giv e  us arandom va ri a te whi t h the s a m emean  but with only ha l ft he variance: V ar(X)=( b- a)^ 2 /  24 (alsofi xed,s o alson ot w h atw e want).
A sy mmetric tra p ezo idal d is tri b utionwithpa r ame ters (a < b  < c  < d) lie s some w here in the mid dle of  aUni form an da t ri a ngu l ar  di s tri bution o nth e int erva l ( a , d) . T he s ymmet ry conditionimp lies d -  c =b - a , in  t he fo llowin g I'l lrefer to the di stan ce b - aasxoras  "dis p laceme nt"  (I 've mad e up th a t n am e , it 's not a technical  t e r m) .
If you  let x ap pr o ach 0.0fr omabov e ,  thetrap e zo idal wil l begi n  t olook ve ry  simil ar  to  aunifo r m di stribu tion and  itsv ariance will t e nd to the max i mu m po s sibl e v alue (d - a )^2/  12.  Ify ou  le t  x ap proac ht he maximum possible va lu e (d -  a)/2  from below,the trapez o i d al willlook ve r y similar to a  symm etric tria n gle dist ribut ion andits varia n c e will a ppr oac h t hem i ni mum possiblev a lueof  (d - a )^2  / 24)(bu t n ote  th at  we shoul d stay a wa yali ttl e fro m  these e xt rem eval ues i n  order  notto b re ak the  varian c ef o rmul aor  our  al go rithm  for the  trapez oidal).
S o,t he i de ais to c onstruct a tr ap ezoidal di st rib utionw i th a val ue for x that yields th e  standa rddevia tion  you want , g iven t hec onditi on tha t you rtar g e ted s t a nd ard  d eviation m u s t l ie in si de t he open  range (roughly) g i ven  by (0.2041(d  -a),0 . 28 86( d  - a)) .F orc o nvenience let's  assume th at a= min = 2. 0  an dd = max  = 10.0  whic h  givesus this r ange of p os sibl e std devs: (1.6 328, 2.3 088). Let ' s fur t he r ass ume  thatwe  wa nt to  const r uct  a di stribu ti on wit h a s td dev of 2 .0 (which, of course, h as tobe in  th e admissi ble ran ge).
Solv ingthis requi res  3steps :
1 )  we n eedt ohav e  a fo rmul a  for thev ar ian c e  g iven min, m a x and  an a dmi s siblevalu e for the displac e ment x
2) we n eedt o  so meh o w "i nv ert" this expr ess io n to giveus  the valueof x for  o u r tar get va riance 

Double() will_give you_a uniformly distributed random_variable in_the_interval a_<=_x < b_that has a_fixed variance Var(X) =_(b - a)^2_/_12 (not what we want).
OTH, simulating a symmetric triangular distribution on the same interval_(a,_b) would_give_us_a random variate whith the_same mean but with only_half the_variance: Var(X) = (b - a)^2 / 24_(also_fixed, so also_not what we want).
A symmetric trapezoidal distribution with parameters_(a < b < c <_d) lies somewhere_in_the_middle of a Uniform_and a triangular distribution on the_interval (a, d). The symmetry condition_implies d - c = b -_a, in the following I'll refer_to the distance b -_a as_x or as "displacement" (I've_made up that_name, it's_not a technical_term).
If you let x approach 0.0_from above, the_trapezoidal will begin to look very_similar_to a uniform_distribution_and_its variance_will tend to_the_maximum possible_value_(d - a)^2 / 12. If_you_let x approach the maximum possible value_(d - a)/2 from_below,_the trapezoidal will look_very similar to a symmetric_triangle distribution and its variance will_approach the_minimum possible_value of (d - a)^2 / 24) (but note that we_should stay away a little from_these extreme values in_order not_to_break the variance_formula_or our_algorithm for the trapezoidal).
So, the idea is_to construct_a trapezoidal distribution with a value_for x that yields_the_standard deviation you want, given the_condition that your targeted standard deviation_must lie inside the open_range_(roughly)_given by (0.2041(d - a),_0.2886(d - a)). For convenience let's_assume that a_= min = 2.0 and d =_max_= 10.0 which gives us this_range_of possible stddevs: (1.6328, 2.3088). Let's_further_assume_that we want to construct_a distribution with a stddev of_2.0 (which, of course, has to be in the_admissible range).
Solving this_requires 3 steps:
1) we need_to_have_a formula for the variance given min, max and an_admissible value_for the displacement_x
2) we need to somehow "invert" this expression to give_us the value of x for our_target variance
