Questions tagged [shuffle]
Shuffling is the act of randomizing the order of the elements in a collection.
2,206
questions
0
votes
0
answers
18
views
Bind two dataframes and shuffle randomly in R
My goal is to bind two dataframes and split it into train and test set.
However, when I do this, it seems like the data is not distributed evenly.
I made a simple data to demonstrate.survived column ...
1
vote
1
answer
18
views
How to ensure that all rows or columns are shifted while shuffling the tensor? [duplicate]
Now I need to randomize an existing tensor of m*m and make sure all rows or columns will not stay in the original position, the shuffle() function provided by python can only achieve the randomization ...
0
votes
1
answer
45
views
What is the time complexity of a while loop that uses random.shuffle (python) inside of it?
first of all, can we even measure it since we don't know how many times random.shuffle will shuffle the array until it reaches the desired outcome
def sort(numbers):
import random
while not sort(...
0
votes
2
answers
37
views
Shuffle a dictionary and list in unison?
I have a dictionary and list with same rows. I would like to shuffle the dictionary and list in unison that is with the same random seed.
test_dict = {3.0: deque([0.897, 24, 45]),
2.0: ...
0
votes
1
answer
45
views
Why should the random number be between 0 and i and not 0 and N-1?
I am learning Knuth shuffle and it says that the random number should be between 0 and i, not N-1 and I can not understand why.
I saw similar questions asked before but cannot find a clear explanation....
0
votes
1
answer
21
views
pytorch DataLoader not shuffling data or returning random data
I am trying to run a toy example of my data. My end goal is for each batch from the dataloader to have different numbers for each sample that is output, but I am getting the same values, despite ...
1
vote
0
answers
14
views
Is it possible to determine audio shuffle/random code & assess it based on the end user's experience?
Firstly, I am not a programmer. I am an end user who has had some recent home audio experiences that confuse me that i believe are related to the random/shuffle code that the manufacturer installed.
...
0
votes
3
answers
80
views
Is there any way to shuffle rows of a matrix without changing the frequency of each column?
I have an NxR random matrix which has in each row shuffled 1:R.
I need another matrix with different sorts of shuffling in each row to have the same distribution of 1 to R for each column.
In other ...
0
votes
2
answers
74
views
Shuffle a 2D string array
I'm doing a C++ program, in which I want to shuffle an array (or part of an array). Here is the array:
string colorTheme[8][8] = {
{"blue", "blue", "green&...
1
vote
1
answer
35
views
Python Shuffle two arrays of numbers so that adjacent ones differ
I have two different arrays with the same qty of values in them(values have duplicates):
first = [1,1,2,2,3,3]
second = [1,1,2,2,3,3]
I want to shuffle these two arrays in order that adjacent values ...
-2
votes
1
answer
16
views
Can I shuffle data for delivery duration estimate problem?
I'm trying to write a solution to a food delivery duration time problem (so called lead time). I used algorithms such as random forest and gradient boosting which gave OK results but not amazing. I ...
0
votes
1
answer
23
views
How to Shuffle List Of Qoutes In Qoutes.json In Kotlin
hi i am new to kotlin and want to get shuffeled my qoutes found in asset here is my peice of code
private fun loadQuotesList(): Array<Quotes> {
val inputStream = context.assets.open(&...
0
votes
1
answer
17
views
Trying to shuffle a custom Stack data structure
I have been working on a project that simulates the "war" card game and made an original main deck and have been trying to get it shuffled with my custom stack class. I tried dividing the ...
-2
votes
1
answer
32
views
Shuffle one of 2 identical lists, making sure no element in the shuffled list is in the same position as in the standard list
Imagine
a=[1,2,3,4,5]
b=[1,2,3,4,5]
I want to shuffle 'b', making sure no element is in the same position as it's in 'a'
Eg: after execution,
[1,5,4,2,3] is not okay because '1' is still in same ...
0
votes
1
answer
26
views
All shuffled list are same in flutter
List<HotAndNEwData> result = response.results;
List<HotAndNEwData> pastYear = result;
pastYear.shuffle();
List<HotAndNEwData> trending = result;
trending.shuffle();
...
1
vote
1
answer
25
views
Randomness of np.random.shuffle
I have two arrays (i and j) that are exactly the same. I shuffle them with a specified random seed.
import numpy as np
np.random.seed(42)
i = np.array([0, 1, 2, 3, 4, 5, 6, 7])
j = np.array([0, 1, 2, ...
-2
votes
2
answers
31
views
Generating M or F for a 100 data point Python
Is there a way of generating a random sample of Male and Female for my dataframe in Python? Doesnt have to be 50:50 but random every time I ran it? Thanks.
0
votes
0
answers
39
views
TypeError "cannot set properties of undefined" when Shuffling Array from Module
when I try to shuffle an array I get a TypeError: "cannot set properties of undefined (setting '10')" where 10 is the value of randomNmbrArr[0]. I have 2 other functions that I copied this ...
3
votes
1
answer
134
views
how can I shuffle node labels and get a new weight vector using NumPy in Python?
I am saving the edge weights of an undirected graph in a row vector. For instance, if I have a graph as pictured below
The vector that I create is [5, 3, 4, 1, 2, 7] as ordered based on node number ...
0
votes
2
answers
38
views
Javascript Shuffle and Random Text in every second using two Function doesn't work
I Need your Help for This Coding Because it doesn't work or only working for 1 class of javascript.
Here's My Coding
HTML
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/...
-4
votes
2
answers
59
views
How to use Javascript Function in all Tags of html with Shuffle and random text
please help me to fixed this problem.
I want to add javascript in tag html but its only work 1 times, why can't 2 or more times?
This is my code :
JS
// Array of words
var words = ["Andre", ...
0
votes
0
answers
21
views
When the actual partition of the data is larger than spark.sql.shuffle.partitions
I know this question is similar to what happens when shuffle partition is greater than 200( spark.sql.shuffle.partitions 200(by default) in dataframe).
But my question is not answered in that question....
1
vote
2
answers
57
views
display an array of images in random order JavaScript
I want to print a javascript array of images in random order but expect the middle one I want this one g.jpg to stay in it is positions
right now all of them are shuffle, how to separate or absolute g....
0
votes
1
answer
51
views
Shuffling method in c++ returning absurd cards
Been following project tutorials and wanted to add my own shuffle method, the output is correct however once I use my shuffle method I get ridiculous values for two spades, for ex. (-68218624 of ...
0
votes
0
answers
52
views
apache zeppelin and spark on kubernetes no communication between executors possible over shuffle
i have this little Problem. I implemented apache zeppelin 0.10.1 on kubernetes. it uses the spark version 3.2.1 . The problem is that the executors cant communicate with each other while shuffling, ...
1
vote
1
answer
29
views
How to randomize or shuffle only one-axis and estimate estimated correlation in R?
I am trying to create a null expectation in R. The dataset has four species and associated sample values of x.real and y.real. I want to create a null expectation by only shuffling the x.real for each ...
-1
votes
1
answer
54
views
Best ways to evaluate randomness of a shuffled list [closed]
I'm trying to qualify the randomness of some shuffled list. Given a list of distinct integers, I want to shuffle it with different random generators or methods and evaluate the quality of the ...
0
votes
1
answer
27
views
Average value of a metric from different pseudo-random runs of two numpy arrays different structures
Given the following Python data structures: There are the same number of rows in df as there are values in labels.
df =
[[0.003 0.9238 0.3882 0.3823]
[0.0383 0.2382 0.8328 0.3823]
...
[0.723 0.3282 ...
1
vote
2
answers
71
views
Trying to convert user define function result into list in python
#Password Generator Project
import random
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D'...
0
votes
1
answer
72
views
Shuffle a specific column in a table on BigQuery
I have a table that looks like this:
id label
1 A
2 A
3 A
4 B
5 C
6 C
7 A
8 A
9 C
10 B
I want to get another column ...
-1
votes
2
answers
55
views
Shuffling elements in an array (C language) [duplicate]
The task is to shuffle an array entered by a user. The problem is probably with passing the array to the shuffle() function, so I must have messed sth up with pointers - however I have no idea where ...
0
votes
0
answers
17
views
Shuffle words randomly using PHP [duplicate]
I want to generate randomly from the array or list of words with defined value.
For non-repeating
// use quotes for your words (else that are constants)
$items = array('hello','one','bank','car','...
4
votes
1
answer
101
views
Efficiency of Rcpp sample v. C++ shuffle
I'm trying to optimize an algorithm for R. Initially, I wrote the algorithm using Rcpp (and Rcpp vectors, etc.) but subsequently rewrote it using standard C++ vectors and only translating it to Rcpp ...
0
votes
0
answers
15
views
Extension or Workaround to Shuffle ALL songs/albums in Spotify
I've long been looking for an extension or some kind of way to shuffle all songs from my library in Spotify, not just the "Liked Songs." When you like an album, it adds to your library but ...
1
vote
1
answer
52
views
Sort a dataframe by a `label` column, shuffle per each `label`, preserve order per `group`
Given the following dataframe:
df = pd.DataFrame(data={'value': ['all', 'moon', 'less', 'cat', 'pen' , 'dark', 'pile'],
'label': [0, 1, 1, 0, 1, 0, 0],
'...
0
votes
2
answers
88
views
Bruteforce python shuffle function
Hello I was wondering how to revert a string that was shuffled with the random.shuffle() function from python.
I know that the original string was shuffled with this code:
import random
...
1
vote
1
answer
96
views
swapping array elements without a temporary variable
The following code:
var words = ['javascript', 'hmtl', 'css', 'python'];
words[0] = words[3];
words[3] = words[0];
alert(words);
...gives the below:
python,hmtl,css,python
Why ...
0
votes
0
answers
45
views
Shuffle button is not working in react native using track-player
I am using react-native-track-player in my existing project, the issue is when user clicks on shuffle button then every time it's playing next song, I'm adding songs data like this..
...
0
votes
0
answers
27
views
Shuffle the content of an ArrayList and display it in real time without change activity
I was creating a simple memory game in which you had a list of colors that you had to memorize within a certain time, then the list with the colors disappeared and you had to choose the colors in ...
0
votes
2
answers
57
views
Why would you add a random variable to the shuffle method?
I don't understand the use of an additional random inside the shuffle method. From the examples I've seen so far, there's not benefit to it, or is there?
It says that it specifies the source of ...
0
votes
2
answers
43
views
Randomly shuffling all files in a directory?
I am trying to find a solution with bash to shuffle a directory full of 2x3000 files of the type:
.mp4
.json (stores the metadata).
The .mp4 and .json are connected to each other so, the problem is:
I ...
0
votes
0
answers
28
views
Add my images to a list and shuffling them [duplicate]
I am trying to add my images (which are cards) to some sort of list and shuffle them so they can be distributed out to the buttons.
The program is a matching game, so when you click on the "...
0
votes
3
answers
73
views
pandas: apply random.shuffle() to list column
I have a dataframe as follows,
import pandas as pd
df= pd.DataFrame({'text':['The weather is nice','the house is amazing','the flowers are blooming']})
I would like to shuffle the words in each row ...
1
vote
1
answer
108
views
shuffling radio button in flutter
let's say i want to make a quiz page that will shuffle the radio button option.
i've done trying to shuffle the List() (containing radio button) in init state but it doesn't working. radio button ...
1
vote
1
answer
102
views
Is "spark.sql.shuffle.partitions" configuration affects non sql shuffling?
We don't have a lot of SQL in our Spark jobs (That is a problem I know but for now its a fact).
I want to optimize the size and number of our Spark shuffle partitions to optimize our Spark usage. I ...
0
votes
2
answers
65
views
Shuffle a list items among dissimilar items
How to shuffle list items keeping the similar items unshuffled? E.g. for the list 'L', I want to shuffle among the unique items.
L=[a,a,b,b,c,c,d,d]
For the above list, I want to get
shuffled_L=[c,c,...
1
vote
1
answer
59
views
How can I sort an array randomly in Fish Shell?
I have an array of strings, I want to shuffle the order of the strings.
I found this question but it deals with bash and I'm using fish shell. Is there a way to achieve this?
0
votes
0
answers
25
views
Assigns the value of each td in the table with a random unique number with Javascript
I have a function that can generate a unique random number, the result is stored in an array. my question. How can each number be entered in rows td when there is a click event.
function random(max, ...
0
votes
0
answers
51
views
Is Collections.shuffle(list); Fisher Yates Algorithm?
List<TriviaQuestion> list;
Collections.shuffle(list);
is Collections.shuffle(list); can it be called Fisher Yates?
for (int i = n-1; i > 0; i--) {
int j = r.nextInt(i+1);
...
0
votes
1
answer
327
views
Pytorch DataLoader shuffle=False?
I used Pytorch DataLoader to create My "batch-data" loder,but I got some problem.
As the definition of the pytorch DataLoader Shuffer.
shuffle (bool, optional) – set to True to have the data ...