Questions tagged as 'random'

1
answer

Generate random numbers in C?

I need to generate 5 random numbers in a range between -10 and +10. How could I do this? I've already seen that you can use shuffle , malloc or even realloc , but being new to C, I do not quite understand how I can make it w...
asked by 04.06.2017 / 23:06
2
answers

Generate random number with current date and time value with Javascript

I would like to know how to generate a random number, based on the current date and time value, using Javascript. I could not get a real example to show here, because I really do not know how to do it.     
asked by 02.05.2015 / 02:48
1
answer

Strange behavior of the rand () function

By setting the documentation echo rand() // Imprime algo completamente aleatório echo rand($min, $max) // Imprime algo em um range entre min e max In a code, inside a loop, I accidentally generated the following rand($max, $min) I...
asked by 24.05.2017 / 10:46
2
answers

How not to repeat random numbers?

I'm creating a rotating banner, and for this I use the random javascript that draws a position in the array and displays, this already works well, the problem is that sometimes it draws the same number at random and repeats what is being display...
asked by 16.12.2015 / 16:11
1
answer

Random number list without repeating Android

I have an ArrayList with N items inside and I need to group them randomly into 2 sets of X items and the rest into another set. However, none of them can be repeated. For example: my ArrayList has 20 items added and I want to split it into 2...
asked by 06.02.2016 / 03:21
2
answers

Generate random number without repetition in C

Hello, I am making a memory game in c, and would like to know how to generate a random number without repetition. I will post what in the function so far. Do I need to do another function only to check if there is a repeated number? void preen...
asked by 21.06.2015 / 22:14
1
answer

How to ignore certain elements in a list that will undergo a random process? (pending)

This program finds magic squares 3x3 by brute force and automatically prints when you find one. code: import random vetor = [1, 2, 3, 4, 5, 6, 7, 8, 9] def magicsquare(): return vetor[0]+vetor[1]+vetor[2]==\ vetor[3]+vetor[...
asked by 28.12.2017 / 23:38
2
answers

Generate random numbers from a predefined set

How to generate a random number in a range of non-sequential numbers. For example, a function that randomly chooses between values, 3, 10, 20, and 2334 in the C language     
asked by 15.06.2015 / 21:23
0
answers

Distributing points evenly in a circle

I started to make a code to randomly distribute points evenly in a circle, however, when generating a point located with a random theta angle between 0 and 2π and with a distance from the center of the random circle of 0 to the radius R, the poi...
asked by 07.10.2017 / 04:51
1
answer

Firebase: How to load random data into a RecyclerView?

I am using a Query to load only 6 Firebase database items in the RecyclerView but so far I can only sort using the orderByChild, limitToFirst or last. Everything is working fine but ... I want to randomly load items into RecyclerView when act...
asked by 04.02.2017 / 17:39