Re: easy question about random numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg53431] Re: easy question about random numbers
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Tue, 11 Jan 2005 01:31:38 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 1/9/05 at 11:03 PM, pedrito6 at softhome.net (Pedrito) wrote: >I have been trying the differents methods for creating random >numbers and I think the faster are these two: <snip> Another approach you might want to consider is to use Interpolation to build a look up table for the inverse cumulative distribution function. For the particular set of probabilities you gave this can be done as follows: invCDF = Interpolation[Transpose[ {FoldList[Plus, 0, {1/6, 1/6, 1/6, 1/6, 9/60, 11/60}], Range[0, 6]}], InterpolationOrder -> 0] then random deviates are obtained using f@Random[] I haven't checked the speed of this method versus the others, but it should be reasonable. -- To reply via email subtract one hundred and four