2,316 questions
0
votes
1
answer
50
views
Why 2 tables bucketed by col1 and joined by (col1, col2) are shuffled?
// Enable all bucketing optimizations
spark.conf.set("spark.sql.requireAllClusterKeysForDistribution", "false")
spark.conf.set("spark.sql.sources.bucketing.enabled&...
-2
votes
1
answer
190
views
how to shuffle the words in a 1d array? [duplicate]
I am writing a shuffling program to shuffle the words in an array, not the letters. For this purpose, I have created the code below:
void shuffle(char *str)
{
srand(time(NULL));
int i = 0;
...
2
votes
2
answers
105
views
Undocumented pandas DataFrame shuffle() [closed]
The following seems to work:
import pandas as pd
import sklearn
df = sklearn.datasets.load_iris()
df = pd.DataFrame(df.data, columns=df.feature_names)
df.shuffle()
However this shuffle function seems ...
0
votes
0
answers
130
views
AVX2 cross-lane shuffles
I'm writing some AVX2 code that is very permutation-heavy. The main permutation instructions used are unpacks, VPSHUFB, some uses of VPERM2I128 and a few of VPBLENDW.
After puzzling over the ...
2
votes
1
answer
86
views
Shuffle a dataset w.r.t a column value
I have the following Dataframe, which contains, among others, UserID and rank_group as attribute:
UserID Col2 Col3 rank_group
0 1 2 3 1
1 1 5 6 1
...
20 1 8 ...
0
votes
3
answers
171
views
Fastest way to randomly shuffle an array based on probabilities in PHP? [closed]
I have an array with values and probabilities (or in PHP, keys and values):
Value Probability
John 3
Peter 2
Paul 1
I want to shuffle this array but have the order be influenced by the ...
0
votes
0
answers
44
views
How can I shuffle grid elements without ruining the layout?
As you can see in the example I have 6 elements "other-news" (colored Fuchsia) on the right side of the grid stacked in 3x2 format. I want to be able to bring them to the left side and keep ...
3
votes
2
answers
104
views
Is there an algorithm for shuffling objects in an array randomly WITHOUT utilizing Lists and Collections
I want to shuffle an array of Objects in a card game simulation.
I scrolled through many posts on here and almost all of them mention transforming the array into a list, then shuffling it using an ...
1
vote
1
answer
80
views
JavaScript shuffle elements but track original index or use modulus to insert them into parent markup
I have the following markup:
<div class="">
<div class="tiled-gallery__gallery">
<div class="tiled-gallery__row columns-1">
<div class=&...
1
vote
1
answer
547
views
Does __shfl_sync in CUDA always operate on registers, or does it involve shared memory or global memory in some certain situations?
This question is inspired by the discussion in this link: When is shfl.sync.idx fast?, where it was debated whether __shfl_sync() and other warp-level shuffle instructions operate directly on the ...
2
votes
1
answer
92
views
How can I shuffle time blocks in time series without overlap in R?
Let's assume there is a group of 3 persons, for which I have a time series of when they start and finish an activity.
An example dataframe would be:
library(tidyverse)
GrXX <- tibble(Individual = ...
0
votes
1
answer
69
views
How do I shuffle a specific 2D cell along the z-axis in a numpy 3D matrix?
Let's say I have a 3D numpy matrix M with shape (c, b, a). I want to shuffle a specific cell (x, y) in M along the z-axis --- that is, I want to shuffle the array [M[z][y][x] for z in range(c)] and ...
-4
votes
1
answer
68
views
python random.shuffle from lists in a text file
Trying to do a random.shuffle which works well if the list is declared.
In example 2, I'm trying to do this from a file that has 1000 entries
with the first two lines shown.
Is the txt file formatted ...
0
votes
1
answer
79
views
What is the time complexity of sample?
Using the default arguments, what is the time complexity of sample? I.e. how does the running time of sample(1:N) grow with N?
Documentation for sample is here but does not specify time complexity.
0
votes
3
answers
139
views
Pulling a shuffled list index returns the value of the original index
I'm attempting a silly little "random" number generator to try to get to grips with how lists and pulling values from them works in python.
I have a variable defined as x, and I ask the code ...