uniform-distribution

How do I generate Log Uniform Distribution in Python?

♀尐吖头ヾ 提交于 2019-11-30 22:59:19
问题 I could not find a built-in function in Python to generate a log uniform distribution given a min and max value (the R equivalent is here), something like: loguni[n, exp(min), exp(max), base] that returns n log uniformly distributed in the range exp(min) and exp(max). The closest I found though was numpy.random.uniform. 回答1: From http://ecolego.facilia.se/ecolego/show/Log-Uniform%20Distribution: In a loguniform distribution, the logtransformed random variable is assumed to be uniformly

Random Numbers with Gaussian and Uniform Distributions in matlab

 ̄綄美尐妖づ 提交于 2019-11-30 06:50:46
问题 I want generate a number in Gaussian and Uniform distributions in matlab. I know this function randi and rand() but all of them are in normal (Gaussian) distribution. How can a generate a random number in uniform distribution? 回答1: Use rand(dimensions) for a Uniform Distribution between 0 and 1. Use randn(dimensions) * sqrt(sigma) + mu for a Gaussian Distribution with a mean of mu and variance of sigma . 回答2: randn is the function to generate Gaussian distributed variables ( randi and rand

Swift - Seeding arc4random_uniform? Or alternative?

放肆的年华 提交于 2019-11-29 02:36:33
Let me start by stating what I'm trying to accomplish: I need to randomly generate a set of numbers within a range I would like those numbers to be somewhat uniformly distributed I need to be able to seed the random number generation such that, given a seed, the resulting random numbers will always be the same. After experimenting quite a bit with drand48(), rand() and arc4random(), I have currently settled on using rand() for obtaining a random number, and srand() for seeding. Here is a small example simplified from what I am doing: let seed: UInt32 = 10 srand(seed) let start = 0 let end =

Generate a random sample of points distributed on the surface of a unit sphere

情到浓时终转凉″ 提交于 2019-11-28 23:25:11
I am trying to generate random points on the surface of the sphere using numpy. I have reviewed the post that explains uniform distribution here . However, need ideas on how to generate the points only on the surface of the sphere. I have coordinates (x, y, z) and the radius of each of these spheres. I am not very well-versed with Mathematics at this level and trying to make sense of the Monte Carlo simulation. Any help will be much appreciated. Thanks, Parin ali_m Based on the last approach on this page , you can simply generate a vector consisting of independent samples from three standard

Random Numbers with Gaussian and Uniform Distributions in matlab

試著忘記壹切 提交于 2019-11-28 22:05:25
I want generate a number in Gaussian and Uniform distributions in matlab. I know this function randi and rand() but all of them are in normal (Gaussian) distribution. How can a generate a random number in uniform distribution? Use rand(dimensions) for a Uniform Distribution between 0 and 1. Use randn(dimensions) * sqrt(sigma) + mu for a Gaussian Distribution with a mean of mu and variance of sigma . randn is the function to generate Gaussian distributed variables ( randi and rand produce uniformly distributed ones). raj You can generate any distribution from rand(). For example , lets say you

Swift - Seeding arc4random_uniform? Or alternative?

末鹿安然 提交于 2019-11-27 16:51:35
问题 Let me start by stating what I'm trying to accomplish: I need to randomly generate a set of numbers within a range I would like those numbers to be somewhat uniformly distributed I need to be able to seed the random number generation such that, given a seed, the resulting random numbers will always be the same. After experimenting quite a bit with drand48(), rand() and arc4random(), I have currently settled on using rand() for obtaining a random number, and srand() for seeding. Here is a

Generate a random sample of points distributed on the surface of a unit sphere

℡╲_俬逩灬. 提交于 2019-11-27 13:58:44
问题 I am trying to generate random points on the surface of the sphere using numpy. I have reviewed the post that explains uniform distribution here. However, need ideas on how to generate the points only on the surface of the sphere. I have coordinates (x, y, z) and the radius of each of these spheres. I am not very well-versed with Mathematics at this level and trying to make sense of the Monte Carlo simulation. Any help will be much appreciated. Thanks, Parin 回答1: Based on the last approach on

Sampling uniformly distributed random points inside a spherical volume

拜拜、爱过 提交于 2019-11-26 21:45:27
I am looking to be able to generate a random uniform sample of particle locations that fall within a spherical volume. The image below (courtesy of http://nojhan.free.fr/metah/ ) shows what I am looking for. This is a slice through the sphere, showing a uniform distribution of points: This is what I am currently getting: You can see that there is a cluster of points at the center due to the conversion between spherical and Cartesian coordinates. The code I am using is: def new_positions_spherical_coordinates(self): radius = numpy.random.uniform(0.0,1.0, (self.number_of_particles,1)) theta =

Sampling uniformly distributed random points inside a spherical volume

血红的双手。 提交于 2019-11-26 08:04:44
问题 I am looking to be able to generate a random uniform sample of particle locations that fall within a spherical volume. The image below (courtesy of http://nojhan.free.fr/metah/) shows what I am looking for. This is a slice through the sphere, showing a uniform distribution of points: This is what I am currently getting: You can see that there is a cluster of points at the center due to the conversion between spherical and Cartesian coordinates. The code I am using is: def new_positions