Questions tagged [deterministic]

The system or program exhibits the same behavior in different runs.

The system or program exhibits the same behavior on different runs. This is opposed to .

353 questions
0
votes
1 answer

does chrome.storage.local.set guarantee order / deterministic

In a scenario where I have 2 buttons, but_A and but_B. but_A.onMouseClicked(chrome.storage.local.set({"key": "A"}, function(){ console.log("but_A val set"); })); but_A.onMouseClicked(chrome.storage.local.set({"key": "B"},…
0
votes
1 answer

Is event recording on time-sensitive possible?

Basic Question Is there any way to event recording an playback within a time-sensitive (framerate independent) system? Any help - including a simple "No sorry it is impossible" - would be greatly appreciated. I have spent almost 20 hours working on…
NtscCobalt
  • 1,639
  • 2
  • 15
  • 31
0
votes
3 answers

Any formula to get point in Bresenham's 2D Line without loop?

Let say we have (x1,y1) and (x2,y2) which might be faraway Can we calculate the point in line that has N distance from (x1,y1)? My simple idea is add count in for loop but this will be expensive if distance is very large *note: floating point can't…
0
votes
1 answer

Creating random colours in PHP based on a string

I would like to create predictable/deterministic colours based on a string. As in, supplying two strings of the same value will generate the same colour. Here is my current code: mt_srand(bin2hex($file)); //Convert filename to hex and seed Mersenne…
0
votes
1 answer

Simple, fair-ish algorithm for deterministically picking a winner between two or more numbers?

I'm looking for a simple algorithm that reliably chooses the same 'winner' from 2 or more different numbers. There's no guarantees about the order in which you receive the numbers (but they can be sorted or something similar). An easy way of solving…
0
votes
1 answer

CPLEX: How to get the real running time in a deterministic way? (Python)

I solved an MIP problem, with making the solving process sleep for 1 second every branch using BranchCallback (single thread). I noticed from the log that the system time measured in seconds changed every run, while the deterministic time measured…
Icarus
  • 25
  • 4
0
votes
1 answer

I need to create a finite automata

Consider the language L of all strings made of the symbols 0, 1 and 2 (Σ = {0, 1, 2}) where the last symbol is not smaller than the first symbol. E.g., the strings 0, 2012, 01231 and 102 are in the language, but 10, 2021 and 201 are not in the…
0
votes
0 answers

Creating a deterministic collection of points using PostGIS

I’m trying to write a PostGIS function that takes: a geographic coordinate (based on, say, EPSG:3785) a density (in points per square meter) and returns an arbitrary number of points, close to the given coordinate, with a hexagonal distribution at…
seymore_strongboy
  • 934
  • 10
  • 16
0
votes
1 answer

If a DFA is minimized, is it guaranteed that it's complement is also minimized?

Consider there is a minimized DFA that accepts the language L. The problem is to find the minimum number of states in its complement. Now if I take the complement of this DFA i;e if I make the non-final states as final and final states as non-final,…
rohith
  • 207
  • 2
  • 9
0
votes
2 answers

Sorting by two integer fields, one desc and one asc, by creating a single value

I have a collection of the following object: public class TestObject { public string Id { get; set;} public int Value1 { get; set; } public int Value2 { get; set; } } As you can see, it contains two integer values. I'd like to sort the…
James Law
  • 6,067
  • 4
  • 36
  • 49
0
votes
2 answers

Is this function pure? (Random computation, deterministic result)

A pure function is defined as a function that: Returns the same value for the same arguments, and Does not produce any side effects (mutation of non-local variables, I/O operations, etc.) Consider a function that calculates the greatest common…
0
votes
1 answer

How does one create a Deterministic Function returning a DATETIME2?

I have a table which nonsensically has DateTime values stored in Year (INT), Month (INT), Day (INT) and Time (FLOAT) columns; unfortunately I'm not allowed to change this but have a requirement to partition the table by Year and Month. Therefore, I…
Matt Arnold
  • 668
  • 2
  • 8
  • 21
0
votes
0 answers

Deterministic random function

I'm developing a little script using Python 3.6. I have a question. If I have a range of number (for example a range of number between 1 and n) and I would like to create a function that, taken as input x some integer value (whatever it is), it…
claudioz
  • 1,121
  • 4
  • 14
  • 25
0
votes
1 answer

Does SQL Server order arbitrary results consistently?

Suppose I have a table with 2 columns and 3 rows: A|B 1|1 1|2 1|3 And I write SELECT TOP 1 B FROM MyTable ORDER BY A SQL Server will arbitrarily pick a value to return. But it seems to consistently return the same arbitrary value no matter how…
Brad
  • 1,360
  • 4
  • 18
  • 27
0
votes
2 answers

Is Math.floor(x/y) deterministic?

According to this post, floating point numbers in JavaScript are not deterministic. I wonder, is the following code deterministic? z = Math.floor(x/y) If not, how can I do deterministic integer division in JavaScript? Edit: I would like to know if…
Simon Farshid
  • 2,636
  • 1
  • 22
  • 31