Re: getting one random number
- To: mathgroup at smc.vnet.net
- Subject: [mg65169] Re: getting one random number
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 16 Mar 2006 06:22:42 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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