New answers tagged

4

Maybe you want a random number generator that uses RandomChoice to map probabilities to outcomes? Ket[0] = {1, 0}; Ket[1] = {0, 1}; ψ = (Ket[0] + Ket[1])/Sqrt[2] (* {1/Sqrt[2], 1/Sqrt[2]} *) RandomChoice[Abs[ψ]^2 -> {0, 1}] (* 0 *) Table[RandomChoice[Abs[ψ]^2 -> {0, 1}], 10] (* {0, 0, 1, 1, 1, 1, 0, 0, 0, 0} *) For added ...


20

I'm pretty sure this is expected. Consider the following implementation of RandomInteger: randomBit[] := RandomInteger[{0, 1}] rand[{min_, max_}] := Module[ {diff, n, res = Infinity}, diff = max - min; n = Ceiling@Log2[max - min + 1]; While[res > diff, res = FromDigits[Table[randomBit[], n], 2] ]; min + res ] Note that we use ...


2

g = TransformedDistribution[x + y, {x \[Distributed] NormalDistribution[], y \[Distributed] NormalDistribution[]}] Mean[g] (* 0 *)


7

You can get clustered points from a random point process and then relax the Voronoi mesh. The final mesh is the variable relaxed: SeedRandom[123]; proc = CauchyPointProcess[15, 35, 0.005, 2]; data = RandomPointConfiguration[proc, Rectangle[]]; bounds = {{0, 1}, {0, 1}}; mesh = VoronoiMesh[data["Points"], {{0, 1}, {0, 1}}]; relaxed = Nest[...


Top 50 recent answers are included