348 questions
2 votes
3 answers
168 views
No result when filtering on a random IntStream, in Java
I am representing a collection of turtles, each with a moment when hatched. I want to randomly choose any mature turtle. I pretend that minutes are years, in this aquarium simulation. record Turtle( ...
1 vote
1 answer
59 views
Parallel random access of vector using indices that are guaranteed to not overlap
Context I have implemented a broad phase collision detection algorithm that returns a nested vector (Vec<Vec<usize>>) of indices. I can guarantee that each index appears at most once ...
0 votes
1 answer
568 views
A convenient way to access a range-v3 view element by index
I'm looking for a means to access, say, a filtered view element by index. Here is a snippet of code for context: std::vector<int> v = {1, 2, 3, 4, 5}; auto v_view = v | ranges::views::filter([](...
1 vote
0 answers
182 views
Random access pagination with search_after on Elasticsearch
There are more than 10 thousand documents in my index, but I cannot access all documents with search. I may also have performance problems with the scroll API. I found a method on how to overcome this ...
0 votes
1 answer
539 views
Have Sysbench memory rndrd/rndwr tests eliminate the affect of cache?
In short, my question is: Should Sysbench eliminate the effect of cache when measuring the memory read/write performance, similar to how the effect of memory is eliminated when measuring the disk ...
0 votes
2 answers
100 views
Exhaust list of elements randomly without sorting them randomly first
If I have a list of 10K elements, and I want to randomly iterate through all of them, is there an algorithm that lets me access each element randomly, without just sorting them randomly first? In ...
-1 votes
1 answer
1k views
How to make 'Published<[String]>.Publisher' conform to 'RandomAccessCollection'
I am trying to make a view that updates based on if the user toggles the favorite button or not. I want the entire view to reconstruct in order to display an array of values whenever that array of ...
3 votes
2 answers
1k views
How to do random access of specific blocks in an .xz file?
My goal is to be able to reduce time needed to look at specific sections from the middle of very large log files compressed to .xz format. If the .xz files are for example 6GB compressed and 60GB ...
3 votes
1 answer
626 views
Random access in a 7z file
I have a 100 GB text file in a 7z archive. I can find a pattern 'hello' in it by reading it by 1 MB block (7z outputs the data to stdout): Popen("7z e -so archive.7z big100gb_file.txt", ...
1 vote
1 answer
83 views
Is creation of an instance of type ArraySlice<Character> via this approach an O(1) time operation?
Re: Swift 5 let str = "my string" let slice: ArraySlice<Character> = ArraySlice(str) Is the ArraySlice created in O(1) time? I'm curious because complexities pertaining to extended ...
0 votes
2 answers
197 views
Getting a random element from a Collection
in java I would like to be able to maintain my Collection of fishes sorted by species at all time (hence the use of a HashMap) while being able to pick a random element from all species except one ...
1 vote
1 answer
1k views
AES 128 CTR random access decryption with cryptography.hazmat in Python
In theory AES encryption in CTR mode allows for decrypting at any block index (that is you don't have to decrypt the whole encrypted data from the begining if you want to decrypt only from a certain ...
1 vote
1 answer
129 views
Best way to randomly access and modify sequential data in Perl
The input to my Perl program is a text file that contains one 'item' per line. For example, a file with below contents: item1 abc yyy anything blabla whatever item2 efg dod whatever blabla mmm item3 ...
1 vote
0 answers
95 views
RandomAccessFile class - trouble with readiing/writing first item of LinkedHashMap
Here is the main code: import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { RandomAccessFile raf = new RandomAccessFile(&...
1 vote
1 answer
256 views
How to design an efficient algorithm to support random access in LZ77 compressed sequences?
I'm working on a project in text compression and I need to design an efficient algorithm in a LZ77 compressed sequences. Specially, Given a LZ77 compressed sequence and an index i, we can recover a ...