Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
69 views

I need to predict Python's random.getrandbits(32) output. I can call a /debug endpoint multiple times to get as many observations as needed, but each observation is only 24 bits. Then I need to ...
Ghost -'s user avatar
  • 17
1 vote
1 answer
85 views

I have legacy code written in Visual Basic 6. It uses Rnd and Randomize to produce an output given an initial random seed. These are the rtcRandomNext and rtcRandomize functions in the MSVBM60.DLL, ...
Kuba hasn't forgotten Monica's user avatar
0 votes
1 answer
101 views

I am making an rng function in C with an upper bound. However, I'm always getting the same sequence of numbers - 3675356291. This is the file I'm using: // The #include block. Contains the header ...
pere T's user avatar
  • 11
Best practices
1 vote
5 replies
129 views

Given an input string, I want to generate a "random" number between 0 and 1. However given the same input string, the returned value should stay the same. I tried something like: Random ...
Nathan H's user avatar
  • 49.7k
4 votes
8 answers
292 views

Starting with the example dat0 below, let's say I want to randomly extract 3 pairs of ìd`s. Initial data (5 id pairs) dat0 <- structure(list(id = c("A", "A", "B", &...
denis's user avatar
  • 972
0 votes
1 answer
57 views

In a v12 TYPO3 site running EXT:news 12.3.0 I'd like to display a random selection of news articles, maintaining other chosen restraints (as limit to categories, respect top news etc.). Best practice ...
webman's user avatar
  • 1,204
2 votes
1 answer
315 views

Recently, on a project, I encountered the need for uniformly distributed integers within an arbitrary range [a, b] from random bytes, a problem that is quite common and is usually solved using ...
Marz's user avatar
  • 23
1 vote
1 answer
125 views

I have a simple example for random stability in QuestaSim. module sv_rand_stability; class dummy; rand int data; endclass initial begin dummy d; $display("%...
Sergey Chusov's user avatar
0 votes
2 answers
112 views

I have a beginner Python program that generates random output and does not take any input. For example, it simulates rolling a dice 5 times and prints the results, their sum, and average: import ...
userfh's user avatar
  • 49
1 vote
1 answer
106 views

I've been digging into "true" randomness idea, and I've noticed that modern CPUs support instructions for generating randomness. X64 has RDRAND instruction, while ARM has RNDR (I'm not ...
freakish's user avatar
  • 57k
0 votes
0 answers
82 views

I have the following code to calculate and visualise the probability of scoring 10 points or more This is the Scoreboard image that I used to run the code from PIL import Image, ImageDraw import ...
Nemo's user avatar
  • 1,306
0 votes
0 answers
67 views

I'm trying to fetch random posts using the WordPress REST API, but the orderby=rand parameter is not working as expected. Instead of returning random posts on each request, it consistently returns the ...
User's user avatar
  • 24.9k
4 votes
3 answers
169 views

I want to iterate through a list of size n, with A 1s in it (the rest are 0s), and I want the 1s randomly distributed. n and A are large, so I'm trying to make a generator instead of a list. If they ...
WeCanDoItGuys's user avatar
6 votes
3 answers
261 views

I need to generate a random integer from 0 (inclusive, but it doesn't matter) to p*q (exclusive, but it doesn't matter) that is divisible by neither p nor q. It just so happens that p and q are ...
nonhuman's user avatar
  • 141
-6 votes
2 answers
198 views

I'm trying to reorder the randomly generated numbers of a set, and I don't know how to do so: import numpy as np import random as rd NUMBER=5 c = np.zeros(NUMBER+1) for k in range(1,NUMBER+1): ...
Médicis's user avatar
2 votes
1 answer
149 views

I'm writing a chess engine in Rust and want to start using Zobrist Hashing, which requires me to pre-initialize an array of pseudo-random numbers from a constant seed. Since this array won't change, I ...
NotARealPerson's user avatar
0 votes
1 answer
132 views

I am working on a small hobby project where I try to create a government for a fictional world. So starting out, I have an assembly of 250 people, with many different details that are being generated ...
Keenonthedaywalker's user avatar
4 votes
2 answers
183 views

Does C standard library provide any function that generate a random permutation of consecutive numbers within a range? How to make a function that efficiently does it? I'm thinking of making a random ...
PkDrew's user avatar
  • 2,301
-1 votes
1 answer
190 views

I need to select 10 to 20 random rows from a table. (I only can find how to select just N random rows). I need to get something like this SELECT * FROM table WHERE ABS(CHECKSUM(NewId())) % 19 BETWEEN ...
Kirik's user avatar
  • 15
0 votes
0 answers
73 views

I'm building a Data Loss Prevention (DLP) tool using a Packet Tunnel Provider on macOS with the NetworkExtension framework. The tunnel sets up proxy settings to redirect HTTP and HTTPS traffic through ...
Manas Singh's user avatar
2 votes
1 answer
87 views

I am trying to create a random numpy array using np.random() but for some reason, instead of taking it as a function, google collab is taking it as a module, I checked the documentation, but I would ...
Aadvik's user avatar
  • 1,522
1 vote
1 answer
52 views

I need to create a number of points in a square [0,1]x[0,1]. To obtain an array of coordinates, I used: N_fixed_points = 10 selection = np.random.random((N_fixed_points,2)) which gives me a proper ...
Andrew's user avatar
  • 1,226
0 votes
2 answers
75 views

I have an array from which I want to select a number of rows, so that the rows selected don't vary if I repeat the sampling process. In my following code, this is not the case; each time I run the ...
Andrew's user avatar
  • 1,226
2 votes
2 answers
75 views

I have created the following pandas dataframe: import pandas as pd import numpy as np ds = {'id':[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26], "Grade":["...
Giampaolo Levorato's user avatar
10 votes
1 answer
178 views

Recently there was a discussion on the reddit c++ subedit pertaining to the difficulties of using the random library. One of the issues was how to correctly seed a random number engines. std::...
Samonir's user avatar
  • 401
2 votes
2 answers
167 views

I would like to generate many batches of random numbers. I only need access to one batch at a time. Naively, I could repeatedly call np.random.randn(size), but that allocates an array each time. For ...
BallpointBen's user avatar
  • 15.7k
-1 votes
1 answer
68 views

In Scheme (extempore version) I sometimes use expressions similar to the following to choose alternative defined callback nodes. (random (cons 0.1 'node1) (cons 0.2 'node2) (cons 0.7 'node3)) This ...
George J Wright's user avatar
2 votes
1 answer
130 views

I have a working formula that I found in the internet {credit to owner} that needs a little tweaking to suit my need. The formula is currently working to provide random numbers based on the following ...
JeremyLongs's user avatar
1 vote
1 answer
117 views

Let's say I have a function that shall generate two random values inside a given range: fn gen_two_numbers(range: Range<u32>) -> (u32, u32) { ... } I tried to implement it like this: fn ...
axolotlKing0722's user avatar
2 votes
1 answer
129 views

As i seen, True RNG (TRNG) in a software-only program is impossible. Modern CPUs not providing TRNG to your software. For example, Intel CPUs starting from Ivy Bridge 3rd generation supports RDRND ...
JOrE's user avatar
  • 155
1 vote
2 answers
183 views

I have a column of 1,800 distinct values in Excel. I want to randomly sample 100 of them. What's the Excel way to do it? I looked here and use the approach described there: =INDEX($A$2:$A$10,...
Nate Anderson's user avatar
0 votes
1 answer
109 views

I'm trying to make a simple dice game using assembly language (MASM). The program generates two random numbers (1~6) and compares them. If the player's number is higher, it prints "You Win!",...
LEE's user avatar
  • 11
0 votes
1 answer
72 views

The following statement uses random() to produce two distinct values: select random(), random(); But the next statement outputs two equal values: select random(), random() order by random(); ...
Code4R7's user avatar
  • 3,156
3 votes
1 answer
237 views

On the Xoshiro webpage, they have the following statement under the heading "Generating uniform doubles in the unit interval": A standard double (64-bit) floating-point number in IEEE ...
Sasha's user avatar
  • 31
1 vote
2 answers
88 views

I'm using Kotlin's default random generator to obtain a float between 0 and 1, which I am using to execute a task for a x% of requests. The Random.nextFloat() call happens only once per Lambda ...
Gourav Aggarwal's user avatar
1 vote
1 answer
100 views

I have a dataset that I need to pull a random sample from. This is the data: {'character': {0: 'mario', 1: 'luigi', 2: 'yoshi', 3: 'peach', 4: 'bowser', 5: 'boo', 6: 'toad', 7: 'lakitu', ...
Tyler Moore's user avatar
2 votes
0 answers
123 views

I am doing a reinforcement learning simulation in Python that involves running many episodes and updating the weights of the agent per episode. To speed up the process, I wish to run parallel ...
user1446642's user avatar
1 vote
0 answers
106 views

I wrote a function in Arduino to generate random numbers with the same number of binary bits as the input. However, when using random() with calculated ranges, the output sometimes doesn't match the ...
石佳恩's user avatar
2 votes
0 answers
127 views

For testing purposes on a table like this: CREATE TABLE my_table ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, . . ...I would like to get the same id's on each test run to better ...
Kjetil S.'s user avatar
  • 3,869
4 votes
3 answers
170 views

I have a pre specified mean [0.5, 0.5, 0]. This is a probability array which sum up to 1. I want to generate several, say 10 random probability arrays (each sums up to 1) whose mean is [0.5, 0.5, 0], ...
jasmine's user avatar
  • 263
0 votes
1 answer
219 views

I have two Dataframes that look like this: df = pd.DataFrame({'PERSONALNUMMER': {4756: '0209740',4820: '0234212',4855: '0251297',4750: '0209326',4992: '4000404'}, 'MANDANT': {4756: 'OM', 4820: 'OM', ...
Mike's user avatar
  • 45
1 vote
3 answers
184 views

I need help coming up with an efficient algorithm that calculates the limits of the area of a rectangle in R based on the proportion of points that fall into it. Let me start with some example data. ...
John Smith's user avatar
0 votes
1 answer
57 views

I am trying to use ThreadPoolExecutor with 8 workers on a csv file data. When I read the csv file using csv.DictReader, I get a dictionaries with header as a key and each row having the value. Now ...
UndyingThanos's user avatar
1 vote
2 answers
167 views

My goal is to use curand_uniform() to have every kernel thread generate a single random number. I am testing the randomness my program generates by treating each generated numbers as an index into a ...
wxz's user avatar
  • 2,636
2 votes
5 answers
114 views

SETUP I have a list days and a value N days = ['Monday','Tuesday','Wednesday','Thursday','Friday'] N = 52 WHAT I AM TRYING TO DO I am trying to create a list selections with length N where I ...
bismo's user avatar
  • 1,645
0 votes
0 answers
98 views

I am aware of suggested best practices for random number generation in NumPy, which basically boil down to: Use the new API, via np.random.default_rng and related functions; and Set a seed at the ...
Kalo's user avatar
  • 93
8 votes
4 answers
387 views

I am trying generate 4 random numbers between -1.0 and 1.0 such that their sum is 1 using python. I initially looked at the dirichlet function in numpy but that only works for positive numbers. One ...
CS1999's user avatar
  • 517
1 vote
3 answers
152 views

I have only been using python for a few months and I am trying to blend my hobby (skating all the london postcodes) with learning to code. I found the following data https://github.com/radiac/UK-...
Premature_Python's user avatar
-1 votes
1 answer
115 views

I am generating random samples from both numpy and scipy for a Poisson distribution, but it appears that scipy never produces values of x=0. Scipy seems to be off by x=1, i.e., it is shifted to the ...
Curtis Smith's user avatar
7 votes
0 answers
332 views

P2075R6 has been accepted into the C++26 standard. It provides the std::philox_engine class template, and the std::philox4x32 and std::philox4x64 aliases with reasonable constants. The proposal ...
Jan Schultke's user avatar
  • 44.4k

1
2 3 4 5
717