[Microbit-Python] Micropython random numbers

Damien George damien.p.george at gmail.com
Wed Nov 25 09:15:14 EST 2015


There is a microbit.random() function.

On Wed, Nov 25, 2015 at 2:10 PM, Michael <sparks.m at gmail.com> wrote:
> Check one of the sensors to see which one is changing lots, and take some
> digits from that?
>
> (If you're shaking it and take values from the accelerometer with pauses
> between from the compass you'll probably get values as random as shaking a
> dice :-) )
>
>
> Michael.
>
> On 25 November 2015 at 13:50, Martin O'Hanlon <martin at ohanlonweb.com> wrote:
>>
>> A microbit is on its way to me...  I've got an idea but it would be really
>> useful to be able to create a random number, the equivalent of
>> random.randint(0,5).
>>
>> From a quick look through Micropython's docs I dont think a random
>> function is available.
>>
>> Has anyone got any inspired thoughts about how I might create a 'pseudo
>> random number' using micropython.
>>
>> Mart
>>
>>
>> --
>>
>> Blog - www.stuffaboutcode.com
>>
>> Twitter - @martinohanlon
>>
>>
>> _______________________________________________
>> Microbit mailing list
>> Microbit at python.org
>> https://mail.python.org/mailman/listinfo/microbit
>>
>
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>


More information about the Microbit mailing list