Generate random names for random bodies
This commit is contained in:
parent
84c6f35de4
commit
e846e4ac71
1 changed files with 3 additions and 2 deletions
|
@ -25,6 +25,7 @@ randomBody = do
|
|||
vx <- randomIO :: IO Double
|
||||
vy <- randomIO :: IO Double
|
||||
vz <- randomIO :: IO Double
|
||||
name <- replicateM 20 $ randomRIO ('a', 'z')
|
||||
-- Make radius proportional to mass for visualization
|
||||
let radius = 20 * m
|
||||
-- Scale mass
|
||||
|
@ -34,7 +35,7 @@ randomBody = do
|
|||
let posy = 1e3 * (2*y - 1)
|
||||
let speedx = 5e-5 * vx
|
||||
let speedy = 5e-5 * vy
|
||||
return $ Body "random" radius mass (P $ V3 posx posy 0) (V3 speedx speedy 0)
|
||||
return $ Body name radius mass (P $ V3 posx posy 0) (V3 speedx speedy 0)
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -78,7 +79,7 @@ csvFromInit n dt b = concat . take n $ map (uncurry csvFromBodies) (steps dt b)
|
|||
main :: IO ()
|
||||
main = do
|
||||
bodies <- replicateM 100 randomBody
|
||||
putStrLn $ csvFromInit 10000 1e-1 bodies
|
||||
putStrLn $ csvFromInit 100000 60 bodies
|
||||
|
||||
{-
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue