MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: getting one random number


On 3/15/06 at 11:59 PM, kmc2104 at columbia.edu (Kevin Coffey) wrote:

>When I exicute the line below, mathematica takes a new random
>number for each element in the list "k[dist]" l[dist_] := Map[# <
>Random[] &, k[dist]]

>I would like mathematica to take one random number and then use the
>same random number for evaluating every element in the list.  Also,
>I want the random number to be different each time I use the
>function.

The following will do what you want

l[dist_]:=
  Module[{x=Random[]}, Map[# < x &, k[dist]]
  
and I assume you have k defined someplace before this function is used
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Unevaluated a[[1]]*a[[2]]
  • Next by Date: Re: How to get rid of If[ ... ] in a result
  • Previous by thread: Re: getting one random number
  • Next by thread: Re: getting one random number