Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
35 views

how to randomize a matrix keeping the rows fixed in python

I'm trying to randomize all the rows of my DataFrame but with no success. What I want to do is from this matrix A= [ 1 2 3 4 5 6 7 8 9 ] to this A_random=[ 4 5 6 7 8 9 ...
sara camp's user avatar
0 votes
1 answer
171 views

Creating matrix from random block rows of another matrix without loop (in R)?

I am trying to create a matrix by drawing random block rows from another matrix. I have managed to do so with a loop. set.seed(1) a_matrix <- matrix(1:10,10,5) # the matrix with original sample ...
Adrien's user avatar
  • 151
0 votes
1 answer
294 views

Random row from matrix with row number Matlab

How to pick a random row from a matrix in Matlab, and also row number of picked row? I'v a matrix named M of 4x3 is following: -21.8318 19.2251 -16.0000 -6.2788 8.6988 -10.0000 1.5553 ...
user avatar
3 votes
3 answers
9k views

C - Matrix, random numbers

I wrote a code to print 5x6 matrix of numbers, but i'm trying to figure out how can I make numbers within matrix random (if possible, within interval). How similar is it to getting random numbers in ...
user2627736's user avatar
0 votes
2 answers
153 views

Python: Why randint on a matrix keeps giving me the same rows [duplicate]

I'm using Python 3 and with this code: import random mat = [[0]*5]*5 for i in range (0,5) : for j in range (0,5) : mat[i][j] = random.randint(10,50) print (mat) I'm getting results ...
user2493860's user avatar
1 vote
1 answer
2k views

Generate several random values where the sum equals a specified criteria (matlab) [duplicate]

Possible Duplicate: Random numbers that add to 100: Matlab I am looking to do the following: Generate several random numbers between 10 and 50. Have the sum of the random numbers equal 500. ...
Kenny's user avatar
  • 43
11 votes
2 answers
16k views

Randomly re-order (shuffle) rows of a matrix?

I would like to randomly re-order the rows of matrix A to generate another new matrix. How to do that in R?
bit-question's user avatar
  • 3,843