Random / Linear Slider



  • I'm trying out Math.randInt on the different slider modes but I can't get anything from the Linear mode. Any ideas what I'm not doing right?

    HiseSnippet 1243.3ocsWEsaaaCEkxwJK1YdaEXe.B4IYfzLYujtVLLDkX6r50XGu3zf0m5Xjni4hDoqDU2bCB1dbusG2eyP9DFv9A5mv9B1FojrHsqThqAldwl7dOWd38d4kWNHf5fBCoA.sJmMcBBn8g5CmRXiaMFhIftsAZane5A8aeROvgSm.CCQt.Ms09ZgTsJkAwe+89GB8fDGjbJ.3bJ1AcL1GyjyNv9YXOuiftnyv9JZuqcWGJoE0iFwYxZ5VfIPmqfWh5CEpURGnsdGWLiFLjAYnPtNGRcmNbL8GII5eNNDegGRLnAXH2PISCZMF64NX1tLD.zJOPtmWKYO+o58vt3r4k68OIVfgDgpOPqz7Tp7bTpQQT5Hpmqv.EPOME5UNgdOPenS.dBSJQvsM06RXnfQPtaWkVI5BJsQY8VTtFD1N9vqPGEvGjgv7QVVaarmkU8urVUtqOjY7ZXfwwc624fSM9JiYHuDwZQ8mPI7AlakHdq4wbzoc91m2oeqWTHrLMV.4Yc5M3jguneqBQlowhH61qSwf3BWP+AcOq0SKDPrzXD0phIdXBxXTDwggoDCJII6WfLf5Y5LC11bC6EgpWq500pVwv.Oxvb1LF7uqS9Q7k311IDwNWnfoYOHa7NAPhKOdXZsiUisMr14IOodcAGV.kyXH4RjqopnLGZQ1rIO31zh+MuIk3xypYN6BY51FMd77VThIWKxiD2gwxggwHxyTwwnhr0CazjSslyapDDp1RJK4e2Tq5MwSmeZQRfeq5hUMM72B54cAuxj4BoEBqqjxzmxPmPLqW85pUpdSUiEEMZTtxRMlGJHWwhRlA2EPSRj+EnfYYlyTjWGY9BUatbEpbR7JJJRIcIX1ISPoikkxDxR10yjZAx1rpSI2ipyFu0xQM4TuakRPZTiWyb8T04pxhqX9QoULG5gcQA.rq3ZrjCTfXmCPSWK9lmk.4l5Ymajf+iOa4.uttHkVh6m2aYWzriVRve7cw3CiXLJIculdkcJR4kxKyR+A5wGcjK6+x+.OuaaHCJtfJ0uyiESPALrHiRqM507a6SttphdaT3UL5j3.S5wItct+PyOkQ0e4armJGXa6icc8PCngXQJubG818AJKQ0kJFVvpb644rJwIIS9c6PFZxP7aPp873q1Bzt19Pog+0+xNLZzHLeFccim9FfO0EEyh.zqhPDmo.UdW49RejVF7LEJ+1eHGJ+Ohv09+V9TtPN5GlxQ9JJZMSkdarTYoJt09Jbz9hBCdacubDzzdlm6LDmO7VScliZqe+mAjV61mqvq+LxFQf7xdhN7NFACHhlmvg8n9bKCC3ZpUZ4BRyNvn3AFnrRe+qJzC..45Ah2xU0aiCcBPLDXNWho8bIdl2Bd2NF48sRci7fr4alUz0dp.AMT6ZTzYHgSuopD48nCWqb6vsQd0sWR59.8AXly374aob3Ku1z+27M88B0z6LZDxgIIaY8i9tU8wAuGT4TZDCStj27SP7419Q9C4OYxAwYBgf7BEkqKIJymL1Z18bCQDWqY0xSE1PLVKUXirB89Pm.5KcRtmP7hjMhmgyIR7iwpn2SL1nQ1ED57VXA7Tb7KcbDthGx4d9XZtBX97U.ytq.l8VALOZEv7Eq.lGemXDUvNHhQ8SNlvmXPm3Kq0z5DWhKNiD7embyKHB
    


  • You're trying to generate a floating point number with randInt.



  • @d-healey oh I want random() 🙂

    Thanks!



  • @d-healey should I be able to use an array in this too? Only the first value in the array is moving...

    HiseSnippet 1366.3ocwXEzaaaCElJMrK1oYXEX21EgbRFHM01KsqCCCUINNqtM1wKNMnEcEcLRzwbQhzkhpqtEEXG2scY.6Ow9Qji63.F189SXX+.1FojrDsqTriA1ltXQ9deO98d583izc4LGbP.iCLJczngXfw0f8FQECZL.QnfV6BLVAd31c18f1fcFMDEDfcAFFW4KTRMJsLH54Ot6NHOD0AmME.bLi3f2m3SDYy109ADOu8Pt3iH9ZZukcKGFsAyiEJYxUfUACQNmgNE2AoTaIHv3pMcIBFum.IvARc1g4Np2.12Ri0+XR.4DOrZPMPOoghmFzX.wys6XuL..LVtalOekXe9CgsItjz4y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iz3hVsHPWsU5qedgQ..H2HPjKWFtKIvgiEXvDgDK6IR7rNe9p.lXCB02bieQhdj5kmJe4+qT+xy29QQD9QFID9q9ulvu68mj2hi4F5gDSd0N0cXSDnXk9cnT2ShJY6HcdcItuW0buuWs75POmz85vtDgyf746R4vW4t++ay2jaOuFrY+9XGQFYWFt2iVzqJeInxgrPAgdp7Xt7nLhNg98XgbGrjITJ1KPk+sjpmb73ppwpHSOL0MZfZ62Dg0TiMRDVarPY4rCm8Lm3Vxp6muRzLRNQi9qIJAaqFal1HGBqtYUUFO4YNNpPwMjbOeL0W.Le7BfYqE.ysV.L2dAv7IK.l6bgXT8H1NTv7iKSjSzsYzwgLLZF0DIJiD7OM8k9LC
    


  • Try Console.print(x); and you'll get you're answer 😉



  • @d-healey It prints out three object numbers.... I don't get it 😆



  • @DanH

    On each iteration x will contain the value of the array at each index. So the first time through it will contain the value at array[0], the second time through the value at array[1], third time through the value at array[2], etc.

    If you want the index number then you need to use a regular for loop instead.



  • @d-healey Silly me! Thanks David 🙂



  • @d-healey So what do I need to do in order to generate random numbers between 0.00 and (for example) 0.50?



  • @DanH said in Random / Linear Slider:

    @d-healey So what do I need to do in order to generate random numbers between 0.00 and (for example) 0.50?

    read the Javascript manual (anywhere on line) for the random command:

    thy this:

    https://www.w3schools.com/js/js_random.asp





  • @DanH

    start here:

    https://www.w3schools.com/js/default.asp

    read thru every page of the manual - compare the javascript versions against the HISE API documentation - some things available in Javascript are NOT available in HISE, and the reverse is also true....but 90% of it will be useful to you.



  • @Lindon found it 👍🏻


Log in to reply
 

18
Online

1.3k
Users

4.1k
Topics

36.3k
Posts