Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

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


  • 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