Questions tagged as 'random'

1
answer

MySQL select random with priorities

I have the following scenario, I have a table and I need to make a select with an order by RAND (). But I'd like to put some conditions for example: TABELA ID | NOME | IDADE | GRUPO    Data 1 | Hiago | 20 | 1 2 | Igor | 15| 1 3 | Ana| 18...
asked by 21.11.2015 / 02:02
2
answers

Generate float values between -1 and 1

I am trying to generate float values between -1 and 1 to test if they are within the defined limits in order to create a vector with the amount of data I want only that I am only able to generate% between 0 and 1 through the function f...
asked by 23.11.2018 / 10:01
4
answers

Manipulating chances with JS when using Math.random ()?

When using this function Math.floor((Math.random() * 10) + 1) I get a random number from 1 to 10. We assume that each number has a 10% chance so we have a 50% Odd or Even chance, but what if I wanted to manipulate those chances, so that t...
asked by 04.04.2017 / 20:26
2
answers

Generate random data within a range

I can not return any number. Ex: If you use "minor 1500" and "greater 5000", it was to appear in this range if you did not enter while , only it is not returning anything. public int aleatoriar(int maior, int menor) { int retorno...
asked by 14.03.2015 / 20:03
2
answers

Error compiling code with import java.util.Random; random.nextInt ()

I'm studying the Java programming language and found an obstacle, by some chance I can not compile this code import java.util.Random; public class Random { public static void main(String[] args){ Random num = new Random();...
asked by 18.07.2016 / 21:50
4
answers

Rand between numbers with comma

How to generate a number float between two numbers? Eg: A random number between -270.33 and -47.5.     
asked by 13.05.2016 / 23:49
1
answer

When I create a function in C ++ do the variables inside it stay in memory?

When I studied pseudocode, I learned that when you call a function and create a variable, it only "exists" when I call that function, for example. funcao teste(): x = 10 retorna x In case, when I called my test function, it woul...
asked by 12.03.2018 / 00:11
2
answers

Maximum value for srand ((unsigned) time (NULL));

I was reading about random numbers not being so random and I saw one way out was to feed a seed with srand((unsigned)time(NULL) ); To test I generated a vector of 100,000 positions and ordered it, but it only has the number 32767...
asked by 09.09.2016 / 01:47
2
answers

Generating random number in C language

Let's say I have an empty array of size 8. int A[8]; And so I intend to populate it with random values whose I would have a function similar to rand(); However, I call rand() for each element of the array, so all eleme...
asked by 20.05.2015 / 00:42
3
answers

Shuffle numbers from a list? [duplicate]

Well, initially I do not understand much of a list in C #, but I have a list of type int that will always have 4 elements that are: 1, 2, 3 e 4 , I'm assigning them with .Add , if someone knows another Give me a little help...
asked by 10.09.2015 / 06:20