35,812 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
123
views
What algorithm does Visual Basic 6 use to generate its pseudorandom numbers?
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, ...
0
votes
1
answer
107
views
RNG function creating the same sequence despite changes to seed [closed]
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 ...
Best practices
1
vote
5
replies
132
views
Predictable random number based on an input string (java)
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 ...
4
votes
8
answers
300
views
How to extract a given number of ordered rows from a given number of randomly selected samples?
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", &...
0
votes
1
answer
59
views
TYPO3 tx_news add 'random' to the 'sort by' list setting
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 ...
2
votes
1
answer
316
views
Does this function result in uniformly distributed integers?
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 ...
1
vote
1
answer
125
views
Random stability with non-random object
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("%...
0
votes
2
answers
112
views
How to create test cases in Polygon for Python program with random values?
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 ...
1
vote
1
answer
107
views
Randomness instructions vs syscalls [closed]
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 ...
0
votes
0
answers
83
views
Coordinates satisfied conditions are outside of the expected area
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 ...
0
votes
0
answers
68
views
WordPress REST API orderby=rand parameter not working - returns same posts instead of random
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 ...
4
votes
3
answers
171
views
Generator that yields True a fixed number of times at random intervals before exhausting
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 ...
6
votes
3
answers
264
views
How can I generate a random integer not divisible by p OR q
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 ...
-6
votes
2
answers
198
views
How to reorder numbers in a set in Python so that the set's numbers are increasing? [closed]
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):
...
2
votes
1
answer
153
views
In Rust is it possible to use a pseudo random number generator with a seed in a const context?
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 ...