add a random start location
This commit is contained in:
@@ -7,15 +7,19 @@ program randomwalk
|
|||||||
use genplotting
|
use genplotting
|
||||||
implicit none
|
implicit none
|
||||||
integer foo, col
|
integer foo, col
|
||||||
|
real px, py
|
||||||
write (0, '(A)') "----[ genplotting randomwalk ]----"
|
write (0, '(A)') "----[ genplotting randomwalk ]----"
|
||||||
call srand(time())
|
call srand(time())
|
||||||
call genp_init (0, 'WS/randomwalk.scratch')
|
call genp_init (0, 'WS/randomwalk.scratch')
|
||||||
do foo=1, 51
|
do foo=1, 20
|
||||||
col = 2 + mod(foo, 4)
|
px = 100 * (rand(0) - 0.50)
|
||||||
call do_randomwalk(42, col)
|
py = 100 * (rand(0) - 0.50)
|
||||||
|
call genp_set_offset(px, py)
|
||||||
|
col = 1 + mod(foo, 6)
|
||||||
|
call do_randomwalk(500, col)
|
||||||
enddo
|
enddo
|
||||||
call genp_end (0)
|
call genp_end (0)
|
||||||
|
stop
|
||||||
contains
|
contains
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
subroutine do_randomwalk(nbre, col)
|
subroutine do_randomwalk(nbre, col)
|
||||||
@@ -30,6 +34,7 @@ subroutine do_randomwalk(nbre, col)
|
|||||||
call genp_line(px, py, px2, py2, col)
|
call genp_line(px, py, px2, py2, col)
|
||||||
px = px2 ; py = py2
|
px = px2 ; py = py2
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! ---------------------------------------------------------
|
! ---------------------------------------------------------
|
||||||
end program
|
end program
|
||||||
|
|||||||
Reference in New Issue
Block a user