Questions tagged [random-walk]

A random walk is a mathematical formalization of a path that consists in a succession of random steps. A random walk can be a Markov chain or process; it can be on a graph or a group. Random walks can model randomized processes, in fields such as: ecology, economics, psychology, computer science, physics, chemistry, and biology.

248 questions
1
vote
1 answer

C# Xna interpolate edges on 2d Image like a 1d Graph

I generated some caves with random walk. The problem is that the output is far too small and i want to scale it up about 10-20 times. When i do so every pixel becomes visible so i need some algorithm to solve this. I thought about some sinus or…
crush3dice
  • 198
  • 1
  • 2
  • 15
1
vote
2 answers

Bash/Nawk whitespace problems

I have 100 datafiles, each with 1000 rows, and they all look something like this: 0 0 0 0 1 0 1 0 2 0 1 -1 3 0 1 -2 4 1 1 -2 5 1 1 -3 6 1 0 -3 7 2 0 -3 8 2 0 …
NictraSavios
  • 502
  • 2
  • 9
  • 29
1
vote
1 answer

Using a `.size()` as an array index

Say I have a some code like: typedef std::vector > > posHistory; posHistory pHist (1, vector>(1, vector(1,0))); that kept track of, for example: The number of dogs. The number of times…
NictraSavios
  • 502
  • 2
  • 9
  • 29
1
vote
1 answer

How to make a Random Walk, PHP?

I've been trying for several hours to make a random walk (a path) like this one. From top to down. x 1 x x 2 3 x x 4 7 6 5 8 x x 9 10 x My greatest difficulty is to calculate the displacement from right to left because the cycles (for,…
Micky
  • 175
  • 1
  • 1
  • 8
1
vote
1 answer

Geometric Brownian Motion in R

When simulating a Geometric Brownian Motion in R with GBM formula from sde package: GBM(x, r, sigma, T, N) "r" is drift in this case, right? Since it says in the package manual "r = interest rate" I'm not sure how to enter the parameter…
AnaBanana
  • 33
  • 1
  • 4
0
votes
0 answers

can anyone help me how to make a collision for 2d map that keep work for all kind of pathfinding that will add later in the code?

I want to make an AI simulation of hide and seek, the problem is when i spread all the tile i can't make the collision for it so the seeker and the hider keep walking across the wall while the pathfinding movement is running. so how to add map…
0
votes
1 answer

Fluctuating total step count in random walk simulation - Need help understanding the cause

I have a random walking code that works sometimes. The algorithm just uses base Python to print a matrix on the terminal; the walk increments every cell it steps on, and it does just that. The one problem is that sometimes it does one less step (or…
0
votes
0 answers

Why different Random Walks with Restart have different results?

I've written two programs to conduct RWR. One uses a networkx graph and I conduct the run on the transition probability matrix: import numpy as np import networkx as nx def run_rwr(nxgraph, a, steps): # Transition probability matrix A =…
Yair
  • 99
  • 8
0
votes
1 answer

Animating 2D random walk trajectory with ggplot in R

I'm trying to create an animation that shows the trajectory of a random walk on the (x,y) plane over time. Each 'step' is a move in either the vertical or horizontal direction, never both. For example, if you start at (0,0) you have only four…
0
votes
1 answer

random walk position generation still generates duplicates even though there is a duplicate checker

As the title says, I created a random walk position generator for our dungeon crawler game. But everytime i generate a room, there is still a duplicate position generated even though there is a duplicate checker (located at posGenerator() while…
0
votes
0 answers

Creating a constrained 3D Random Walk [Python]

I have an implementation of a random walk in 3D that can move in 6 directions at random to create random looking 3D points. Currently this approach creates purely random surface plots. I am trying to add the following constraints to the random walk…
karthik subramanian
  • 153
  • 1
  • 2
  • 11
0
votes
1 answer

Python Random Walk Simulation - How to set the particle to be released from the edge of a box

Here is some python code for a random walk simulation. The code allows you to set the particle's initial position however I want the particle to be released specifically from the edge of a "box"/the array, before it does its random walk. import…
Ellie
  • 5
  • 2
0
votes
3 answers

Why is my C# class code in an infinite loop? What can I do to fix it?

namespace Random_walk_2d { internal class Program { static void Main(string[] args) { Point C = new Point(2, 5); C.Move('n'); Point.Print(C); } } public class Point { …
Imaginary
  • 75
  • 7
0
votes
0 answers

Jupyter Notebook kernel dying in the middle of running code

I am trying to run this code in jupyter notebook and it runs halfway but then the kernel restarts and the code stops running. Does anyone know a fix for this? import numpy as np import matplotlib.pyplot as plt def ant(nx, ny, nmoves): arr =…
0
votes
1 answer

Python 2D self-avoiding random walk

I want to make a self-avoiding 2D random walk in python. Imagine it like the dot is on the square grid and it can only go up, down, left or right but it cannot land twice on the same point. I have an idea how to do it, but my programming skills…
Teodora
  • 11
  • 1