VE Lua Documentation

Press F to search!

randomGauss3

Definition


-- @/lua/common/mathlib.lua:642

-- returns random gauss number in [0..3]
function randomGauss3()
  return random() + random() + random()
end

Callers

@/lua/vehicle/sounds.lua
        playSoundOnceAtNode("event:>Surfaces>kickup_asphalt", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = randomGauss3() * 8 / wheelSound.tirePropertiesKickup
      -- print(string.format("KICKUP ASPHALT Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup) .. " " .. wd.name)
      rigidSurfaceType = 0.175
      -- rigidRollVolume = min(1, max(absWheelSpeed, min(slip, groundSpeed)) * 0.025) * (randomGauss3() * 0.33 + 0.5) * cobbleStoneContactSmooth
      rigidRollVolume = min(1, max(abs(absWheelSpeed - slip), sideSlip) * 0.02) * cobbleStoneContactSmooth
      rigidSurfaceType = 0.375
      -- rigidRollVolume = min(1, max(absWheelSpeed, slip) * 0.025) * randomGauss3() * 0.66 * woodContactSmooth
      rigidRollVolume = min(1, max(abs(absWheelSpeed - slip), sideSlip) * 0.025) * woodContactSmooth
        playSoundOnceAtNode("event:>Surfaces>kickup_dirt", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = randomGauss3() * 8 / wheelSound.tirePropertiesKickup
      -- print(string.format("KICKUP DIRT Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup) .. " " .. wd.name)
        playSoundOnceAtNode("event:>Surfaces>kickup_dirtDusty", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = wheelSound.looseSurfaceKickupLimit + randomGauss3() * 20 / wheelSound.tirePropertiesKickup
      -- print(string.format("KICKUP DUST Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup) .. " " .. wd.name)
        playSoundOnceAtNode("event:>Surfaces>kickup_grass", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = randomGauss3() * 12 / wheelSound.tirePropertiesKickup
      -- print (string.format("KICKUP GRASS Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup).." "..wd.name)
        playSoundOnceAtNode("event:>Surfaces>kickup_gravel", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = wheelSound.looseSurfaceKickupLimit + randomGauss3() * 16 / wheelSound.tirePropertiesKickup
      -- print (string.format("KICKUP Slip=%.2f : Slip*Properties=%.2f", slip * 12, slip * wheelSound.tirePropertiesKickup * 12).." "..wd.name)
        playSoundOnceAtNode("event:>Surfaces>kickup_mud", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = randomGauss3() * 8 / wheelSound.tirePropertiesKickup
      -- print (string.format("KICKUP MUD Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup).." "..wd.name)
        playSoundOnceAtNode("event:>Surfaces>kickup_rock", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = randomGauss3() * 8 / wheelSound.tirePropertiesKickup
      -- print (string.format("KICKUP ROCK Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup).." "..wd.name)
        playSoundOnceAtNode("event:>Surfaces>kickup_sand", wd.node1, kickupVolume * wd.tireSoundVolumeCoef, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, 1)
        wheelSound.looseSurfaceKickupLimit = randomGauss3() * 4 / wheelSound.tirePropertiesKickup
      -- print (string.format("KICKUP SAND Vol=%.2f : Pitch=%.2f : Color=%.2f : tirePropertiesKickup=%.2f", kickupVolume, wheelSound.tirePropertiesVolRoll, wheelSound.tirePropertiesPitch, wheelSound.tirePropertiesKickup).." "..wd.name)
@/lua/ge/extensions/career/modules/delivery/generator.lua
    if vehInfo.filter.whiteList.Mileage then
      offer.vehicle.mileage = randomGauss3()/3 * (vehInfo.filter.whiteList.Mileage.max - vehInfo.filter.whiteList.Mileage.min) + vehInfo.filter.whiteList.Mileage.min
    else
@/lua/ge/extensions/util/terrainGenerator.lua
    for y = 1, 256 do
      arr[x][y] = randomGauss3() / 5
    end
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
    end
    local value = mod.isLinear and math.random() or randomGauss3() / 3 -- linear or gaussian randomness
    personality[v] = clamp(value + (mod.offset or 0), mod.min or 0, mod.max or 1)
@/lua/vehicle/powertrain/combustionEngineThermals.lua
      local node = nodes.exhaust[random(#nodes.exhaust)]
      local tickSize = linearScale(randomGauss3(), 0, 3, 0, 1) ^ heatTickData.exhaustTickSizeBias
      sounds.playSoundOnceFollowNode(heatTickData.exhaustTickEventName, node, heatTickData.exhaustTickVolume, heatTickData.exhaustTickPitch, tickSize)
      heatTickData.exhaustTickBucket = 0
      heatTickData.exhaustTickBucketThreshold = heatTickData.exhaustTickPeriodGain * linearScale(randomGauss3(), 0, 3, 0.25, 1.75)
    end
      local node = nodes.engine[random(#nodes.engine)]
      local tickSize = linearScale(randomGauss3(), 0, 3, 0, 1) ^ heatTickData.engineTickSizeBias
      sounds.playSoundOnceFollowNode(heatTickData.engineTickEventName, node, heatTickData.engineTickVolume, heatTickData.engineTickPitch, tickSize)
      heatTickData.engineTickBucket = 0
      heatTickData.engineTickBucketThreshold = heatTickData.engineTickPeriodGain * linearScale(randomGauss3(), 0, 3, 0.25, 1.75)
    end
@/lua/ge/extensions/gameplay/parking.lua
    local xGap, yGap = max(0, parkingSpot.scl.x - width), max(0, parkingSpot.scl.y - length)
    local xRandom, yRandom = randomGauss3() / 3 - 0.5, clamp(randomGauss3() / 3 - (backwards and 0.75 or 0.25), -0.5, 0.5)
    offsetPos = vec3(xRandom * offsetVal * xGap, yRandom * offsetVal * yGap, 0)
    local xGap, yGap = max(0, parkingSpot.scl.x - width), max(0, parkingSpot.scl.y - length)
    local xRandom, yRandom = randomGauss3() / 3 - 0.5, clamp(randomGauss3() / 3 - (backwards and 0.75 or 0.25), -0.5, 0.5)
    offsetPos = vec3(xRandom * offsetVal * xGap, yRandom * offsetVal * yGap, 0)
    offsetPos = vec3(xRandom * offsetVal * xGap, yRandom * offsetVal * yGap, 0)
    offsetRot = quatFromEuler(0, 0, (randomGauss3() / 3 - 0.5) * offsetVal * 0.25)
  end
@/lua/ge/extensions/editor/objectToSplineEditor.lua
  scl = scl or 1
  return gauss and (randomGauss3() / 3 - 0.5) * 2 * scl or (math.random() - 0.5) * 2 * scl
end
@/lua/vehicle/powertrain/combustionEngine.lua
  if device.idleTimer <= 0 then
    local idleTimeRandomCoef = linearScale(device.idleTimeRandomness, 0, 1, 1, randomGauss3() * 0.6666667)
    device.idleTimer = device.idleTimer + device.idleTime * idleTimeRandomCoef
@/lua/ge/extensions/career/modules/vehicleShopping.lua
        if filter.whiteList and filter.whiteList.Mileage then
          randomVehicleInfo.Mileage = randomGauss3()/3 * (filter.whiteList.Mileage.max - filter.whiteList.Mileage.min) + filter.whiteList.Mileage.min
        else