Questions tagged [uniform]

Uniform is a jQuery plugin that beautifies standard form elements such as inputs, selects and radiobuttons with new styled elements.

Uniform is a jQuery plugin that beautifies standard form elements such as inputs, selects and radiobuttons with new styled elements. Uniform supports "theming", eg use of alternative CSS classes as a theme.

260 questions
142
votes
16 answers

Evenly distributing n points on a sphere

I need an algorithm that can give me positions around a sphere for N points (less than 20, probably) that vaguely spreads them out. There's no need for "perfection", but I just need it so none of them are bunched together. This question provided…
Befall
  • 5,824
  • 8
  • 22
  • 28
55
votes
5 answers

In python, what is the difference between random.uniform() and random.random()?

In python for the random module, what is the difference between random.uniform() and random.random()? They both generate pseudo random numbers, random.uniform() generates numbers from a uniform distribution and random.random() generates the next…
NKCP
  • 581
  • 1
  • 4
  • 3
33
votes
8 answers

jQuery Uniform Checkbox does not (un)check

I am using jQuery Uniform to style inputs/selects etcs. However, the checkbox has stopped working. I am appending data sent from an ajax call. Once it's loaded, I use $.uniform.update("input:checkbox") to update the new html. When attempting to…
nderjung
  • 1,579
  • 3
  • 16
  • 37
24
votes
5 answers

random unit vector in multi-dimensional space

I'm working on a data mining algorithm where i want to pick a random direction from a particular point in the feature space. If I pick a random number for each of the n dimensions from [-1,1] and then normalize the vector to a length of 1 will I…
Matt
  • 1,463
  • 3
  • 15
  • 32
16
votes
4 answers

Uniformity of random numbers taken modulo N

One common way of choosing a random number in [0, n) is to take the result of rand() modulo n: rand() % n. However, even if the results returned by the available rand() implementation are fully uniform, shouldn't there be a problem with the…
dragonroot
  • 5,010
  • 2
  • 30
  • 57
15
votes
7 answers

What is the optimal algorithm for generating an unbiased random integer within a range?

In this StackOverflow question: Generating random integer from a range the accepted answer suggests the following formula for generating a random integer in between given min and max, with min and max being included into the range: output = min +…
Desmond Hume
  • 6,732
  • 13
  • 57
  • 104
14
votes
2 answers

How to find the border points of a particular shape

Suppose I have a irregular, random, shape generated from a dataset. How do I find points that are situated on the shape's border? I am using R. Are there any packages in R for this purpose? For simplicity, just assume that I have a 2d dataset of…
Pradeep
  • 535
  • 7
  • 13
13
votes
9 answers

How to generate three random numbers, whose sum is 1?

I need to generate 3 random numbers, the amount of which is equal to 1. My implementation does not support uniform distribution. :(
antigravity
  • 178
  • 2
  • 9
13
votes
1 answer

Why is there no glBindAttribLocation() equivalent for uniform variables?

I'm learning OpenGL and noticed that I have the option to use either glGetAttribLocation() or glBindAttribLocation() when dealing with input attributes but for uniforms, I have to use glGetUniformLocation(). Is there any technical reason for not…
Izaan
  • 515
  • 7
  • 14
11
votes
3 answers

Python pandas: conditionally select a uniform sample from a dataframe

Say I have a dataframe as such category1 category2 other_col another_col .... a 1 a 2 a 2 a 3 a 3 a 1 b 10 b 10 b 10 b 11 b 11 b …
TheRealFakeNews
  • 5,707
  • 13
  • 56
  • 85
10
votes
1 answer

GLSL indexing into uniform array with variable length

I am passing an uniform array to geometry shader and want to index into it using a variable. I can use variable length array & index with fixed number (numeric constant) OR I can define a fixed length array & index using varible. However I can't…
Jitu
  • 127
  • 1
  • 1
  • 7
10
votes
4 answers

Generating a uniform distribution of INTEGERS in C

I've written a C function that I think selects integers from a uniform distribution with range [rangeLow, rangeHigh], inclusive. This isn't homework--I'm just using this in some embedded systems tinkering that I'm doing for fun. In my test cases,…
solvingPuzzles
  • 7,683
  • 14
  • 62
  • 110
9
votes
1 answer

Behavior of uniforms after glUseProgram() and speed

How fast is glUseProgram()? Is there anything better (faster)?: Here are my thoughts: Use 1 universal shader program, but with many input settings and attributes (settings for each graphics class) Use more than 1 shader for each graphics…
9
votes
4 answers

Proper way to generate a random float given a binary random number generator?

Let's say we have a binary random number generator, int r(); that will return a zero or a one both with propability 0.5. I looked at Boost.Random, and they generate, say, 32 bits and do something like this (pseudocode): x =…
orlp
  • 98,226
  • 29
  • 187
  • 285
9
votes
2 answers

WebGL: passing uniform arrays to shader

Tried to do just like here: Pass array to shader And like here: Passing an array of vectors to a uniform But still no luck. I think I do just like there but it doesn't work: Here's my JavaScript code: shaderProgram.lightsUniform =…
Dmitry
  • 463
  • 2
  • 4
  • 18
1
2 3
17 18