<commit_before>package me.callmeavarice.jbox2d.tests;

import org.jbox2d.collision.shapes.CircleShape;
import org.jbox2d.collision.shapes.EdgeShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.*;
import org.jbox2d.testbed.framework.TestbedTest;

import java.util.Random;

public class PuttingBounceInTheMoshPit extends TestbedTest {
    @Override
    public void initTest(boolean b) {
        Vec2 gravity = new Vec2(0.0f, -10.0f);
        boolean doSleep = true;

        World world = getWorld();
        world.setAllowSleep(doSleep);
        world.setGravity(gravity);

        // Environment body
        {
            BodyDef bd = new BodyDef();
            Body ground = getWorld().createBody(bd);


            EdgeShape shape = new EdgeShape();

            // Ground
            shape.set(new Vec2(-20.0f, 0.0f), new Vec2(20.0f, 0.0f));

            FixtureDef fd = new FixtureDef();
            fd.shape = shape;
            fd.density = 0.0f;
            fd.friction = 0.6f;

            ground.createFixture(fd);

            // Left-hand edge
            shape.set(new Vec2(-20, 0.0f), new Vec2(-20.0f, 40.0f));
            ground.createFixture(fd);

            // Right-hand edge
            shape.set(new Vec2(20, 0.0f), new Vec2(20.0f, 40.0f));
            ground.createFixture(fd);
        }

        {
            // A range of different values to be randomly chosen for each actor to give them all different attributes.
            float[] strength = {0.19f, 0.23f, 0.28f, 0.36f, 0.43f, 0.55f, 0.58f, 0.43f, 0.55f, 0.66f};
            float[] weight = {0.19f, 0.23f, 0.28f, 0.36f, 0.48f, 0.55f, 0.58f, 0.63f, 0.72f, 0.88f};
            float[] power = {1.75f, 2.05f, 2.45f, 2.69f, 3.25f, 3.84f, 4.12f, 4.25f, 4.75f, 5f};

            // We'll model each actor as a circle
            CircleShape m_shape1 = new CircleShape();
            m_shape1.m_radius = 0.9f;
            FixtureDef fd = new FixtureDef();
            fd.shape = m_shape1;
            fd.density = 0.85f;
            fd.friction = 0.35f;
            // Bounciness
            fd.restitution = 0.99f;


            // Populate the scene with Moshers
            for(float x = -19.1f; x <= 20f; x=x+1.81f) {
                Random randomIndex = new Random();
                fd.density = strength[randomIndex.nextInt(10)];
                fd.friction = weight[randomIndex.nextInt(10)];

                BodyDef bd = new BodyDef();
                bd.type = BodyType.DYNAMIC;
                bd.position.set(x, 00.0f);
                Body m_body1 = getWorld().createBody(bd);

                // Jump!
                Vec2 force  = new Vec2(0, power[randomIndex.nextInt(10)]);
                Vec2 point = m_body1.getWorldPoint(m_body1.getWorldCenter());
                m_body1.applyLinearImpulse (force ,point);

                m_body1.createFixture(fd);
            }
        }
    }

    @Override
    public String getTestName() {
        return "Bounce";
    }
}<commit_msg>Slightly tweaking the test to enhance the simulation's behaviour.<commit_after>package me.callmeavarice.jbox2d.tests;

import org.jbox2d.collision.shapes.CircleShape;
import org.jbox2d.collision.shapes.EdgeShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.*;
import org.jbox2d.testbed.framework.TestbedTest;

import java.util.Random;

public class PuttingBounceInTheMoshPit extends TestbedTest {
    @Override
    public void initTest(boolean b) {
        Vec2 gravity = new Vec2(0.0f, -10.0f);
        boolean doSleep = true;

        World world = getWorld();
        world.setAllowSleep(doSleep);
        world.setGravity(gravity);

        // Environment body
        {
            BodyDef bd = new BodyDef();
            Body ground = getWorld().createBody(bd);


            EdgeShape shape = new EdgeShape();

            // Ground
            shape.set(new Vec2(-20.0f, 0.0f), new Vec2(20.0f, 0.0f));

            FixtureDef fd = new FixtureDef();
            fd.shape = shape;
            fd.density = 0.0f;
            fd.friction = 0.6f;

            ground.createFixture(fd);

            // Left-hand edge
            shape.set(new Vec2(-20, 0.0f), new Vec2(-20.0f, 40.0f));
            ground.createFixture(fd);

            // Right-hand edge
            shape.set(new Vec2(20, 0.0f), new Vec2(20.0f, 40.0f));
            ground.createFixture(fd);
        }

        {
            // A range of different values to be randomly chosen for each actor to give them all different attributes.
            float[] strength = {0.19f, 0.23f, 0.28f, 0.36f, 0.43f, 0.55f, 0.58f, 0.43f, 0.55f, 0.66f};
            float[] weight = {0.19f, 0.23f, 0.28f, 0.36f, 0.48f, 0.55f, 0.58f, 0.63f, 0.72f, 0.88f};
            float[] power = {1.75f, 2.05f, 2.45f, 2.69f, 3.25f, 3.84f, 4.12f, 4.25f, 4.75f, 5f};

            // We'll model each actor as a circle
            CircleShape m_shape1 = new CircleShape();
            m_shape1.m_radius = 0.9f;
            FixtureDef fd = new FixtureDef();
            fd.shape = m_shape1;
            fd.density = 0.65f;
            fd.friction = 0.5f;
            // Bounciness
            fd.restitution = 0.99f;


            Random randomIndex = new Random();

            // Populate the scene with Moshers
            for(float x = -19.1f; x <= 20f; x=x+1.805f) {
                fd.density = weight[randomIndex.nextInt(10)];
                fd.friction = strength[randomIndex.nextInt(10)];

                BodyDef bd = new BodyDef();
                bd.type = BodyType.DYNAMIC;
                bd.position.set(x, 00.0f);
                Body m_body1 = getWorld().createBody(bd);

                // Jump!
                Vec2 force  = new Vec2(0, power[randomIndex.nextInt(10)]);
                Vec2 point = m_body1.getWorldPoint(m_body1.getWorldCenter());
                m_body1.applyLinearImpulse (force ,point);

                m_body1.createFixture(fd);
            }
        }
    }

    @Override
    public String getTestName() {
        return "Bounce";
    }
}
{'fraction_non_alphanumeric': 0.12335827098919368, 'fraction_numerical': 0.06051537822111388, 'mean_word_length': 1.7160270880361175, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3318288', 'n_tokens_mistral': 2252, 'n_tokens_neox': 1988, 'n_words': 438}