Re: Beginner--Help on Listing Values

*To*: mathgroup at smc.vnet.net*Subject*: [mg74965] Re: Beginner--Help on Listing Values*From*: "dimitris" <dimmechan at yahoo.com>*Date*: Fri, 13 Apr 2007 01:59:13 -0400 (EDT)*References*: <evhtp3$2tq$1@smc.vnet.net>

Hello. Clear["Global`*"] rand[h:Integer | Real, {(a_)?NumberQ, (b_)?NumberQ}, d_Integer] := (#1/ Tr[#1] & )@Table[Random[h, {a, b}], {d}] ls1 = rand[Integer, {-30, 30}, 20] ls2 = rand[Real, {-10, 10}, 30] {13/152, 5/38, 5/152, 17/152, -(13/76), -(1/19), 3/38, 3/152, 17/152, 11/152, 5/152, 25/152, 7/152, 1/38, 0, -(13/76), 25/152, 11/152, 1/8, 9/76} {0.160557,0.192586,-0.0993901,-0.179493,0.390724,-0.124995,-0.487228,-0.\ 110376,-0.444609,-0.0932739,0.0812527,-0.470073,0.130112,-0.0265495,-0.1212= 24,\ -0.188016,0.10593,0.100737,0.399792,-0.469098,-0.0471127,0.416487,0.437451,= 0=2E\ 481372,0.312831,-0.296601,0.01634,0.140363,0.442609,0.348895} (*Test*) Tr@ls1 Tr@ls2 1 1=2E Dimitris where =CF/=C7 m.lungay at gmail.com =DD=E3=F1=E1=F8=E5: > I need to create a list of probability values for a certain random variab= le X. It is very difficult if i keep on enumerating the entries especially = when the length required is large, say the list is of length 100. Maybe the= re is some way where I could generate the entries in a random manner. There= is a code Random[], but how could I implement it in a List manner so that = the sum of the results must be 1. Please help! > > > > Link to the forum page for this post: > http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName== Special:Forum_ViewTopic&pid=17333#p17333 > Posted through http://www.mathematica-users.org [[postId=17333]]