Tag Info

Hot answers tagged

14

After some amount of effort, I managed to come up with an implementation of O'Neill's "XSH-RR" family of permuted congruential generators. The following covers the 8-, 16-, 32-, and 64-bit generators, and the mcg, oneseq, and setseq variants. (I'll leave the modification to handle the unique variant as an exercise for the interested reader.) A similar ...


13

I just followed through with the tutorial "Defining Your Own Generator". Start with provided, a little tweaked functions. The key trick is to ensure that the bit-expandable Mathematica integers are of the size of relative machine unsigned integers. I use BitAnd with mask to accomplish that: pcgRandomR[state_, inc_] := Module[{ newstate, xorshifted, rot, ...


9

The polygon of interest is state = Entity["AdministrativeDivision", {"Illinois", "UnitedStates"}]; (polygon = state["Polygon"]) // Short (* Polygon[GeoPosition[{{{36.9821, -89.1329}, <<187>> ,{36.9821, -89.1329}}}]] *) however that expression is not a valid region RegionQ[polygon] (* False *) because the argument of Polygon[] is not a ...


7

To me this looks like a bug. A possible workaround is to use ProbabilityDistribution together with the PDF of the VonMisesDistribution: SeedRandom[1] RandomVariate@ProbabilityDistribution[PDF[VonMisesDistribution[0, 0], x], {x, -∞, ∞}] $\ $ 1.99422 This bug is caused by the evaluation of Statistics`NormalDistributionsDump`compiledvonmisesrandom[0, 0, ...


5

I get on Mathematica 10.2, Ubuntu 14.04 In[10]:= Map[{First[ Timing[Do[ RandomVariate[BinomialDistribution[10 #, 1/#]], {100}]]], First[Timing[ Do[RandomVariate[ BinomialDistribution[10 #, 1/(# + 1)]], {100}]]]} &, {1500, 3000, 5000, 10000}] Out[10]= {{0.023484, 2.37428}, {0.012502, 6.22335}, {0.013843, 12.4218}, ...


5

Please edit with your results: MMa 10.0.0.0, Windows 8.1 – Sektor {0.015625, 0.03125}, {0.`, 0.0625}, {0.`, 0.125}, {0.`, 0.`}} MMa 10.0.0.0 through MinGW & mintty, Windows 8.1 – Sektor {0., 0.03125}, {0., 0.0625}, {0., 0.125}, {0., 0.}} MMA 10.2, Ubuntu 12.04 - blochwave {0.03, 0.1, ...


4

RandomVariate for BinomialDistribution[n,p] changes between methods depending on the value of Min[n*{p,1-p}]. What we're seeing here is that one of those methods is poorly optimized. Because of this thread, we've made some improvements which should improve speed when Min[n*{p,1-p}]<10. These will be in the next release of Mathematica. We'll also ...


4

As noted in the comment by WRI staff, this is indeed a bug in the interplay between RandomVariate and the distribution at hand. The obvious workaround for now is to use UniformDistribution[{μ - Pi, μ + Pi}] for zero-concentration cases.


2

The random functionality within Mathematica is all of a pattern: RandomFunction[range, outputStructure] where range depends on what RandomFunction you are using, e.g. for RandomInteger and RandomReal it is {min, max} and they both default to {0,1} if no min/max are supplied. The outputStructure tells the RandomFunction how many random numbers you want and ...


2

It would seem that if only a Method is given and it does not change what is already set that the seed is not randomized: Table[ SeedRandom[Method -> "ExtendedCA"]; SeedRandom[1]; SeedRandom[Method -> "ExtendedCA"]; RandomInteger[10, 10] , {3} ] {{1, 4, 0, 7, 0, 0, 8, 6, 0, 4}, {1, 4, 0, 7, 0, 0, 8, 6, 0, 4}, {1, 4, 0, 7, 0, 0, 8, 6, 0, 4}} ...


2

As long as you use Set (m =) rather than SetDelayed (m :=) the matrix will not be given new values unless you reevaluate the definition of m. SeedRandom[1]; Clear[m] m = RandomReal[{0, 1}, {2, 2}] {{0.817389, 0.11142}, {0.789526, 0.187803}} m {{0.817389, 0.11142}, {0.789526, 0.187803}} m {{0.817389, 0.11142}, {0.789526, 0.187803}} m ...



Only top voted, non community-wiki answers of a minimum length are eligible