Services & Resources / Wolfram Forums
MathGroup Archive
*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
  • Subject: [mg65182] Re: [mg65154] getting one random number
  • From: Bob Hanlon <hanlonr at>
  • Date: Fri, 17 Mar 2006 00:13:26 -0500 (EST)
  • Reply-to: hanlonr at
  • Sender: owner-wri-mathgroup at

l[dist_] := Module[{r = Random[]}, Map[# < r &, k[dist]]];

Bob Hanlon

> From: "Kevin Coffey" <kmc2104 at>
To: mathgroup at
> Subject: [mg65182] [mg65154] getting one random number
> 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 
> 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 
> 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

  • Prev by Date: A Reap Sow question
  • Next by Date: Subscripted variables and function definitions
  • Previous by thread: Re: getting one random number
  • Next by thread: Construction of Vandermonde equations: