Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Re: Extended Random Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21580] Re: [mg21500] Extended Random Function
  • From: BobHanlon at aol.com
  • Date: Sat, 15 Jan 2000 02:04:23 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Needs["Statistics`ContinuousDistributions`"]

randomNbr[dist_, digits_Integer?Positive] := 
  Module[{rN = Random[dist], f}, 
    f = 10^(digits - Ceiling[Log[10, Abs[rN]]]);
    N[Round[f*rN]/f]]

Table[
    randomNbr[NormalDistribution[0, 5], k], 
    {k, 10}] // InputForm

{2., -5.6, -3.68, 3.178, 1.9008, 13.5738, -1.904861, 
 -0.10891599, 6.47057332, -0.2439976141}

Bob Hanlon

In a message dated 1/14/2000 4:02:59 AM, d_mennella at my-deja.com writes:

>I have a question concerning the use of the
>extension of the Random[] function as defined in
>the Statistics`ContinuousDistributions`. With
>this extension it is possible to pick a random
>number according to a given distribution function.
>
>My question is: how is it possible to pick a Real
>number with n digits? With the default function
>it is possible to do so by calling
>
>Random[Real,{xmin,xmax},ndigits]
>
>but I have found no way to do this with the
>extended function.
>


  • Prev by Date: Re: Q: Preventing Subscripts from being interpreted as expressions?
  • Next by Date: Filtered Backprojection
  • Previous by thread: Re: Extended Random Function
  • Next by thread: Re: Extended Random Function