Re: getting one random number
- To: mathgroup at smc.vnet.net
- Subject: [mg65172] Re: [mg65154] getting one random number
- From: jmt <jmt at dxdydz.net>
- Date: Thu, 16 Mar 2006 06:22:44 -0500 (EST)
- References: <200603160459.XAA12117@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Try this :
(for the sake of demonstration only :)
k[u_] := u
(uses a different random value each time the function lp is called :)
lp[dist_] := With[{r = Random[]}, Map[# < r &, k[dist]]
On Thursday 16 March 2006 05:59, Kevin Coffey wrote:
> Greetings:
>
> I am a fairly new user and I have come across this problem twice. The last
> time I just worked my way around it, but this time I can't.
>
> 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.
>
> Any help would be most appreciated.
>
> Thank you.
>
> Kevin
- References:
- getting one random number
- From: "Kevin Coffey" <kmc2104@columbia.edu>
- getting one random number