Hi Andrew, Jimmy has already shown how to create a byte array, so I'll translate the rest:
from System.Security.Cryptography import RNGCryptoServiceProvider from System import BitConverter, Random rndC = RNGCryptoServiceProvider() rndC.GetBytes(rndBytes) seed = BitConverter.ToInt32(rndBytes, 0); rand = Random(seed); return rand.Next(min, max); In general, to convert C# to Python: drop semicolons ( ; ) drop braces ( { } ) drop 'new' drop types drop namespaces add 'def' to functions change foreach to for remove parens ( ( ) ) from if, for, while add colons ( : ) after class, def, if, while change 'using Foo' to 'from Foo import *' (bad style in Python, but it works) and a few other, more complicated steps Heck, writing a script to do it wouldn't be all that hard, and it shows just how much noise is in C#. - Jeff On Wed, Aug 4, 2010 at 5:02 PM, Andrew Evans <evans.d.and...@gmail.com> wrote: > Hello > > I am trying to follow a tutorial written for silverlight and C# and convert > the code to Iron Python. However I am unsure about how to use this code as > IronPython > > Byte[] rndBytes = new Byte[10]; > > RNGCryptoServiceProvider rndC = new RNGCryptoServiceProvider(); > rndC.GetBytes(rndBytes); > int seed = BitConverter.ToInt32(rndBytes, 0); > Random rand = new Random(seed); > > return rand.Next(min, max); > > what modules do I need. How do I use Byte in IronPython etc > > Any ideas advice *cheers > > > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com