[Microbit-Python] Micropython random numbers

Michael sparks.m at gmail.com
Wed Nov 25 09:10:05 EST 2015


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 <http://twitter.com/intent/user?screen_name=martinohanlon>
>
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/microbit/attachments/20151125/26f2347e/attachment.html>


More information about the Microbit mailing list